View Single Post
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-10-2010 , 03:52   Re: Boolean - include file
Reply With Quote #6

Quote:
Originally Posted by Lulu the hero View Post
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.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 12-10-2010 at 14:18.
Exolent[jNr] is offline