[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pointless Threads (64Bit ints )




Word of warning, the whole 64bit ints on 32bit systems thing
is just something thrown into PenugniPlay.h because we could,
not because we thought there was going to be much need for
it, so there seems little point agonizing too much about getting
it right.

Just my RS 0.02

Matt Slot writes:
 >  > I experimented a bit with "long long" variables, and they apparently behave
 >  > just like a nice 64bit int should behave. Arithmetic operations work,
 >  > making arrays of them works, bit shifting/masking works and getting their
 >  > address works. Seems as if we can safely use them...
 > 
 > If you want to stay portable, you probably should make a suite of macros that
 > take advantage intrinsic 64-bit types/arithmetic if available, and calculate
 > them manually if not:
 > 
 >    typedef unsigned short    UInt16;
 >    typedef unsigned long     UInt32;
 > 
 > #ifdef INTRINSIC_64BIT /* or something */
 > 
 >    typedef unsigned longlong UInt64;
 >    #define Add64(r,x,y)  (void) ((r) = (x) + (y))
 > 
 > #else
 > 
 >    typedef struct { UInt32 hi, lo; } UInt64;
 >    #define Add64(r,x,y) __MyAdd64(&(r), &(x), &(y))
 > 
 > #endif
 > 
 > 
 > Inlining the manual calculations will help their performance a bit.
 > 
 > Matt
 > 
 > 
 > /* Matt Slot, Bitwise Operator * One box, two box, yellow box, blue box. *
 >  *  <fprefect@ambrosiasw.com>  * <http://www.ambrosiasw.com/~fprefect/>  */
 > 
 > 
 > 
 > ---------------------------------------------------------------------
 > To unsubscribe, e-mail: penguinplay-unsubscribe@sunsite.auc.dk
 > For additional commands, e-mail: penguinplay-help@sunsite.auc.dk
 >