00001
00002
00003
00004 #ifndef __BYTEORDER_H
00005 #define __BYTEORDER_H
00006
00007
00008 #include <machine/endian.h>
00009
00010
00011 #include <byteswap.h>
00012 #define swap16(x) bswap_16(x)
00013 #define swap32(x) bswap_32(x)
00014 #define swap64(x) bswap_64(x)
00015
00016
00017 #include <_stdint.h>
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef be16atoh
00028 # define be16atoh(x) be16toh(*(uint16_t*)(x))
00029 #endif
00030 #ifndef be32atoh
00031 # define be32atoh(x) be32toh(*(uint32_t*)(x))
00032 #endif
00033 #ifndef be64atoh
00034 # define be64atoh(x) be64toh(*(uint64_t*)(x))
00035 #endif
00036 #ifndef le16atoh
00037 # define le16atoh(x) le16toh(*(uint16_t*)(x))
00038 #endif
00039 #ifndef le32atoh
00040 # define le32atoh(x) le32toh(*(uint32_t*)(x))
00041 #endif
00042 #ifndef le64atoh
00043 # define le64atoh(x) le64toh(*(uint64_t*)(x))
00044 #endif
00045
00046 #ifndef htob16a
00047 # define htobe16a(a,x) *(uint16_t*)(a) = htobe16(x)
00048 #endif
00049 #ifndef htobe32a
00050 # define htobe32a(a,x) *(uint32_t*)(a) = htobe32(x)
00051 #endif
00052 #ifndef htobe64a
00053 # define htobe64a(a,x) *(uint64_t*)(a) = htobe64(x)
00054 #endif
00055 #ifndef htole16a
00056 # define htole16a(a,x) *(uint16_t*)(a) = htole16(x)
00057 #endif
00058 #ifndef htole32a
00059 # define htole32a(a,x) *(uint32_t*)(a) = htole32(x)
00060 #endif
00061 #ifndef htole64a
00062 # define htole64a(a,x) *(uint64_t*)(a) = htole64(x)
00063 #endif
00064
00065 #endif