Note on populating a uint's bits: The shifting left(<<) method is faster than the shift right(>>>) method. (>>>) is faster than (<<), but setting the LEAST significant bit is faster than setting the most significant bit. theUint = theUint << 1; theUint = theUint | 1; theUint = theUint >>> 1; theUint = theUint | mostSigBit; //Where mostSigBit = 0x80000000 DO NOT HARDCODE. //Will be super slow if you do. //Don't do this: //theUint = theUint | 0x80000000;
No comments:
Post a Comment