Supposed I do the following:
b= b + a;
, where b is a long long variable and a is an int variable
Will the compiler do any type casting which is expensive? Does this depend on the...
Type: Posts; User: cybernike
Supposed I do the following:
b= b + a;
, where b is a long long variable and a is an int variable
Will the compiler do any type casting which is expensive? Does this depend on the...
Why when we pass output/input streams to functions, we have to pass by reference?
Thanks.
I just checked. It is 3.4.6 .
if I am using an intel Core 2 Duo CPU, what would be my cpu match for the optimization option [-march= ??????] ?
For now, I don't need 4294967295 elements for a class or data type. The question was hypothetical. I know declaring a 3D array does not change the memory usage. What I was trying to say is the...
What if I ever need more than 4294967295 (max of unsighed long int) elements in an array?
My compiler wouldn't recognize an integer larger than 4294967295.
Thanks.
bool Set(int element, bool value)
{
if (element > elementCount)
return false;
int ed32 = element / 32;
int em32 = element % 32;
unsigned int modValue;
if (value)
Thanks.
I should be more specific; I also want to use the memory in the heap by using the new operator to declare the 3D array and instantiate it using the constructor.
How may I do that?
Say I have a class:
class foo()
{
public:
foo(int n){
x=n;
}
How could I make the syntax look similar to a 3D array so that I can put x,y,z coordinates to the bitsets?
Thanks.
Yep..still too large.
Does the "long long" definition only work for a 64-bit OS?
for the line:
modValue = 4294967296 - (1 << em32);
my compiler, g++, is saying the number is larger than the max of long.
what should I do? I tried to use "long long" to define modValue. Same...
That was me. Thanks a lot. I'm currently testing another structure written by another user. I will definitely try your code and let you know the speed too.
Thanks again.
Suppose I have a template class:
template<class A, int B>
class foo
{
.....
}
is it possible to instantiate the template class with a variable in the second paramter?
Thanks to Budda, David, and everyone else. I will incorporate your ideas and run empirical tests to compare the speeds.
I'll let you all know the results.
Let me state the problem more clearly. In a 1000x1000x1000 space, there are 1000 particles. We can only move one particle at a time, and the particle can move in one of the six directions by 1 unit...
Thanks, I will definitely try to get some ideas from game programming.
If I have to choose between memory and speed, speed is definitely more important.
I have not specified the time scale;...
Doing a search for a few points through a vector? why only a few points? do you mean you have done some kind of sorting that would tell us the nearest neighbors of a particular particle?
I really...
With what you said, let the radius be 1.
I'd like to know if a point with coordinates (1,1,1) has any particles right next to it. I would have to check if any particle would have the coordinates...
I was thinking to let my program only represent points that exist in the 3D space, since there are many more slots than the number of the points in the 3D space. However, if I declare a struct like...
It is a matrix that represents a 3D space. If that point is true, that means something is on that space. Any better idea than using a matrix? Speed is very important.
You are right that it is for voxel data (I had to look up what voxel means). I am writing a Monte Carlo program that describes brownian motions.
I will definitely look into RLE, if it could reduce...
You're the man. Thanks.
I really meant "initialize", i.e., assigning a value to the variable when declaring the variable.
I should have mentioned that the global variable is also a constant variable; therefore, I need...