kdewin
byteswap.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef KDE_BYTESWAP_H
00020 #define KDE_BYTESWAP_H
00021
00022 #define bswap_16(x) (((x) << 8) & 0xff00) | (((x) >> 8 ) & 0xff)
00023 #define bswap_32(x) (((x) << 24) & 0xff000000) \
00024 | (((x) << 8) & 0xff0000) \
00025 | (((x) >> 8) & 0xff00) \
00026 | (((x) >> 24) & 0xff )
00027 #define bswap_64(x) ((((x) & 0xff00000000000000ull) >> 56) \
00028 | (((x) & 0x00ff000000000000ull) >> 40) \
00029 | (((x) & 0x0000ff0000000000ull) >> 24) \
00030 | (((x) & 0x000000ff00000000ull) >> 8) \
00031 | (((x) & 0x00000000ff000000ull) << 8) \
00032 | (((x) & 0x0000000000ff0000ull) << 24) \
00033 | (((x) & 0x000000000000ff00ull) << 40) \
00034 | (((x) & 0x00000000000000ffull) << 56))
00035
00036 #endif