1 2 #ifdef BUILDING_FS_SHELL 3 # include "compat.h" 4 #else 5 # include <BeOSBuildCompatibility.h> 6 #endif 7 8 #include <ByteOrder.h> 9 10 #if __GNUC__ < 4 11 uint16 __swap_int16(uint16 value)12__swap_int16(uint16 value) 13 { 14 return (value >> 8) | (value << 8); 15 } 16 17 uint32 __swap_int32(uint32 value)18__swap_int32(uint32 value) 19 { 20 return (value >> 24) | ((value & 0xff0000) >> 8) | ((value & 0xff00) << 8) 21 | (value << 24); 22 } 23 24 uint64 __swap_int64(uint64 value)25__swap_int64(uint64 value) 26 { 27 return uint64(__swap_int32(uint32(value >> 32))) 28 | (uint64(__swap_int32(uint32(value))) << 32); 29 } 30 #endif 31