diff options
| author | Alex Marshall <SquidMan72@gmail.com> | 2009-02-19 22:55:10 -0800 |
|---|---|---|
| committer | Alex Marshall <SquidMan72@gmail.com> | 2009-02-19 22:55:10 -0800 |
| commit | f3ce109d4d834691adeb75e55c99e5958478f4a6 (patch) | |
| tree | 8874b33a893863b491ba81f59b068c8b304302f5 /endian.h | |
| parent | 3fe246100c2d5aa3972f8ec9cf96464a22b60237 (diff) | |
Fixed endian.h and .c to be more logical (no more functions in headers) which should also make it work correctly on Windblows systems. (Also, I fixed all the warnings! =D)
Diffstat (limited to '')
| -rwxr-xr-x | endian.h | 26 |
1 files changed, 3 insertions, 23 deletions
@@ -7,32 +7,12 @@ //#define be32(x) ((x>>24)|((x<<8)&0x00FF0000)|((x>>8)&0x0000FF00)|(x<<24)) //#define be64(x) ((x>>56)|((x<<40)&(u64)0x00FF000000000000)|((x<<24)&(u64)0x0000FF0000000000)|((x<<8)&(u64)0x000000FF00000000)|((x>>8)&(u64)0x00000000FF000000)|((x>>24)&(u64)0x0000000000FF0000)|((x<<40)&(u64)0x000000000000FF00)|(x<<56)) -u16 be16(u16 x) -{ - return (x>>8) | - (x<<8); -} +u16 be16(u16 x); -u32 be32(u32 x) -{ - return (x>>24) | - ((x<<8) & 0x00FF0000) | - ((x>>8) & 0x0000FF00) | - (x<<24); -} +u32 be32(u32 x); // __int64 for MSVC, "long long" for gcc -u64 be64(u64 x) -{ - return (x>>56) | - ((x<<40) & (u64)0x00FF000000000000) | - ((x<<24) & (u64)0x0000FF0000000000) | - ((x<<8) & (u64)0x000000FF00000000) | - ((x>>8) & (u64)0x00000000FF000000) | - ((x>>24) & (u64)0x0000000000FF0000) | - ((x>>40) & (u64)0x000000000000FF00) | - (x<<56); -} +u64 be64(u64 x); #endif //_ENDIAN_H_ |
