[Plib-cvs] plib/src/util ul.h,1.63,1.64
Brought to you by:
sjbaker
From: Steve B. <sj...@us...> - 2004-03-14 18:15:30
|
Update of /cvsroot/plib/plib/src/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17049/plib/src/util Modified Files: ul.h Log Message: Exposed the underlying (and most convenient) byte swap routines so the user can play with them instead of the incredibly clunky ones we currently have. Index: ul.h =================================================================== RCS file: /cvsroot/plib/plib/src/util/ul.h,v retrieving revision 1.63 retrieving revision 1.64 diff -u -d -r1.63 -r1.64 --- ul.h 25 Feb 2004 15:39:34 -0000 1.63 +++ ul.h 14 Mar 2004 18:06:27 -0000 1.64 @@ -322,14 +322,14 @@ static const int _ulEndianTest = 1; #define ulIsLittleEndian (*((char *) &_ulEndianTest ) != 0) #define ulIsBigEndian (*((char *) &_ulEndianTest ) == 0) -static inline void _ulEndianSwap(unsigned int *x) { +static inline void ulEndianSwap(unsigned int *x) { *x = (( *x >> 24 ) & 0x000000FF ) | (( *x >> 8 ) & 0x0000FF00 ) | (( *x << 8 ) & 0x00FF0000 ) | (( *x << 24 ) & 0xFF000000 ) ; } [...93 lines suppressed...] } } @@ -434,7 +434,7 @@ if (ulIsBigEndian) { return x; } else { - _ulEndianSwap(&x); + ulEndianSwap(&x); return x; } } @@ -443,7 +443,7 @@ if (ulIsBigEndian) { return x; } else { - _ulEndianSwap((unsigned int*)&x); + ulEndianSwap((unsigned int*)&x); return x; } } |