Bug in bit(x) macro
by Tim Hutcheson · in Torque Game Engine · 04/04/2006 (7:11 am) · 0 replies
In objectTypes.h, the bit(x) macro should be fixed for use with U64 data. Otherwise it propagates a sign bit into the result when x>31.
Replace
with
Edit: In fact, I wound up using this to get it to work for 64-bit data:
Replace
#define bit(x) (1 << (x))
with
#define bit(x) ((unsigned)1 << (x))
Edit: In fact, I wound up using this to get it to work for 64-bit data:
#define bit(x) (((x)>31) ? ((unsigned)1<<((x)-32))*0x100000000 : ((unsigned)1<<(x)))