Quote:
Originally Posted by Lulu the hero
Updated it with your ideas, thank you very much. I left the limit to 32. A 31 sized bit array would be useless for 32 players on a server - I use these functions for player bits to avoid the following code types:
PHP Code:
new is_alive[33];
// something happened, toggle is_alive off: is_alive[id] = 0;
// or turn it on: is_alive[id] = 1;
With this, 32 bits stored on 33*cellbits storage. What a waste. 1 of the 33 integers are used up only - or 0.5 of 33 if on a 64 bit processor.
|
I don't know where you thought I said anything about an array, but I didn't.
1<<(32-1) would give the same results as 1<<(32&1) but IIRC bit operations are quicker.
__________________