View Single Post
  #4  
Old 05-27-2006, 12:22 AM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
First of all, Graal doesn't support above 32bits for numbers (I think).
Second, what I said was correct

if (flags & (0x100000001 | 0x10000))

[edit]

We had a discussion about this on IRC and we came to that I misunderstood your original question, mostly because your original question was not written very well.

Anyway, my point of view: you're using bitflags for the wrong reason.

But uhh, here's how I would do it:

PHP Code:
function getFlagCount(flags)
{
  
temp.count 0;
  while (
temp.flags 0)
  {
    
temp.count += temp.flags 1;
    
temp.flags >>= 1;
  }
  return 
temp.count;


Last edited by Rick; 05-27-2006 at 12:48 AM..
Reply With Quote