12#define swap16(x) bswap_16(x) 
   13#define swap32(x) bswap_32(x) 
   14#define swap64(x) bswap_64(x) 
   33# define htobe16(x) htons(x) 
   36# define htobe32(x) htonl(x) 
   39# define be16toh(x) ntohs(x) 
   42# define be32toh(x) ntohl(x) 
   45#define HTOBE16(x) (x) = htobe16(x) 
   46#define HTOBE32(x) (x) = htobe32(x) 
   47#define BE32TOH(x) (x) = be32toh(x) 
   48#define BE16TOH(x) (x) = be16toh(x) 
   52# define htole16(x)      (x) 
   55# define htole32(x)      (x) 
   58# define htole64(x)      (x) 
   61# define le16toh(x)      (x) 
   64# define le32toh(x)      (x) 
   67# define le64toh(x)      (x) 
   70#define HTOLE16(x)      (void) (x) 
   71#define HTOLE32(x)      (void) (x) 
   72#define HTOLE64(x)      (void) (x) 
   73#define LE16TOH(x)      (void) (x) 
   74#define LE32TOH(x)      (void) (x) 
   75#define LE64TOH(x)      (void) (x) 
   79# define htobe64(x)      swap64(x) 
   82# define be64toh(x)      swap64(x) 
   85#define HTOBE64(x)      (x) = htobe64(x) 
   86#define BE64TOH(x)      (x) = be64toh(x) 
   98#define be16atoh(x)     ((uint16_t)(((x)[0]<<8)|(x)[1])) 
   99#define be32atoh(x)     ((uint32_t)(((x)[0]<<24)|((x)[1]<<16)|((x)[2]<<8)|(x)[3])) 
  100#define be64atoh_x(x,off,shift)         (((uint64_t)((x)[off]))<<(shift)) 
  101#define be64atoh(x)     ((uint64_t)(be64atoh_x(x,0,56)|be64atoh_x(x,1,48)|be64atoh_x(x,2,40)| \ 
  102        be64atoh_x(x,3,32)|be64atoh_x(x,4,24)|be64atoh_x(x,5,16)|be64atoh_x(x,6,8)|((x)[7]))) 
  103#define le16atoh(x)     ((uint16_t)(((x)[1]<<8)|(x)[0])) 
  104#define le32atoh(x)     ((uint32_t)(((x)[3]<<24)|((x)[2]<<16)|((x)[1]<<8)|(x)[0])) 
  105#define le64atoh_x(x,off,shift) (((uint64_t)(x)[off])<<(shift)) 
  106#define le64atoh(x)     ((uint64_t)(le64atoh_x(x,7,56)|le64atoh_x(x,6,48)|le64atoh_x(x,5,40)| \ 
  107        le64atoh_x(x,4,32)|le64atoh_x(x,3,24)|le64atoh_x(x,2,16)|le64atoh_x(x,1,8)|((x)[0]))) 
  109#define htobe16a(a,x)   (a)[0]=(uint8_t)((x)>>8), (a)[1]=(uint8_t)(x) 
  110#define htobe32a(a,x)   (a)[0]=(uint8_t)((x)>>24), (a)[1]=(uint8_t)((x)>>16), \ 
  111        (a)[2]=(uint8_t)((x)>>8), (a)[3]=(uint8_t)(x) 
  112#define htobe64a(a,x)   (a)[0]=(uint8_t)((x)>>56), (a)[1]=(uint8_t)((x)>>48), \ 
  113        (a)[2]=(uint8_t)((x)>>40), (a)[3]=(uint8_t)((x)>>32), \ 
  114        (a)[4]=(uint8_t)((x)>>24), (a)[5]=(uint8_t)((x)>>16), \ 
  115        (a)[6]=(uint8_t)((x)>>8), (a)[7]=(uint8_t)(x) 
  116#define htole16a(a,x)   (a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x) 
  117#define htole32a(a,x)   (a)[3]=(uint8_t)((x)>>24), (a)[2]=(uint8_t)((x)>>16), \ 
  118        (a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x) 
  119#define htole64a(a,x)   (a)[7]=(uint8_t)((x)>>56), (a)[6]=(uint8_t)((x)>>48), \ 
  120        (a)[5]=(uint8_t)((x)>>40), (a)[4]=(uint8_t)((x)>>32), \ 
  121        (a)[3]=(uint8_t)((x)>>24), (a)[2]=(uint8_t)((x)>>16), \ 
  122        (a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x)