You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

31 lines
931 B

#ifndef _SWAP_H_
#define _SWAP_H_
#define __swab16(x) (uint16_t)__builtin_bswap16((uint16_t)(x))
#define __swab32(x) (uint32_t)__builtin_bswap32((uint32_t)(x))
#define __swab64(x) (uint64_t)__builtin_bswap64((uint64_t)(x))
#define cpu_to_le64(x) ((__u64)(x))
#define le64_to_cpu(x) ((__le64)(x))
#define cpu_to_le32(x) ((__u32)(x))
#define le32_to_cpu(x) ((__le32)(x))
#define cpu_to_le16(x) ((__u16)(x))
#define le16_to_cpu(x) ((__le16)(x))
#define cpu_to_be64(x) __swab64((x))
#define be64_to_cpu(x) __swab64((x))
#define cpu_to_be32(x) __swab32((x))
#define be32_to_cpu(x) __swab32((x))
#define cpu_to_be16(x) __swab16((x))
#define be16_to_cpu(x) __swab16((x))
#define ___htonl(x) cpu_to_be32(x)
#define ___htons(x) cpu_to_be16(x)
#define ___ntohl(x) be32_to_cpu(x)
#define ___ntohs(x) be16_to_cpu(x)
#define htonl(x) ___htonl(x)
#define ntohl(x) ___ntohl(x)
#define htons(x) ___htons(x)
#define ntohs(x) ___ntohs(x)
#endif