#include <sys/endian.h>

sys/endian.h

includes: sys/cdefs.h, sys/_types.h, sys/_endian.h, libkern/_OSByteOrder.h
15 macros · 12 functions

macrobswap16

General byte order swapping functions.
#define bswap16(x) __bswap16(x)

macrobswap32

#define bswap32(x) __bswap32(x)

macrobswap64

#define bswap64(x) __bswap64(x)

macrohtobe16

Macros to convert to a specific endianness.
#define htobe16(x) __bswap16((x))

macrohtobe32

#define htobe32(x) __bswap32((x))

macrohtobe64

#define htobe64(x) __bswap64((x))

macrohtole16

#define htole16(x) ((__uint16_t)(x))

macrohtole32

#define htole32(x) ((__uint32_t)(x))

macrohtole64

#define htole64(x) ((__uint64_t)(x))

macrobe16toh

#define be16toh(x) __bswap16((x))

macrobe32toh

#define be32toh(x) __bswap32((x))

macrobe64toh

#define be64toh(x) __bswap64((x))

macrole16toh

#define le16toh(x) ((__uint16_t)(x))

macrole32toh

#define le32toh(x) ((__uint32_t)(x))

macrole64toh

#define le64toh(x) ((__uint64_t)(x))

functionbe16dec

static __inline __uint16_t be16dec(const void *__sized_by(sizeof(__uint16_t)) pp)
Routines to encode/decode big- and little-endian multi-octet values to/from an octet stream.

functionbe32dec

static __inline __uint32_t be32dec(const void *__sized_by(sizeof(__uint32_t)) pp)

functionbe64dec

static __inline __uint64_t be64dec(const void *__sized_by(sizeof(__uint64_t)) pp)

functionle16dec

static __inline __uint16_t le16dec(const void *__sized_by(sizeof(__uint16_t)) pp)

functionle32dec

static __inline __uint32_t le32dec(const void *__sized_by(sizeof(__uint32_t)) pp)

functionle64dec

static __inline __uint64_t le64dec(const void *__sized_by(sizeof(__uint64_t)) pp)

functionbe16enc

static __inline void be16enc(void *__sized_by(sizeof(__uint16_t)) pp, __uint16_t u)

functionbe32enc

static __inline void be32enc(void *__sized_by(sizeof(__uint32_t)) pp, __uint32_t u)

functionbe64enc

static __inline void be64enc(void *__sized_by(sizeof(__uint64_t)) pp, __uint64_t u)

functionle16enc

static __inline void le16enc(void *__sized_by(sizeof(__uint16_t)) pp, __uint16_t u)

functionle32enc

static __inline void le32enc(void *__sized_by(sizeof(__uint32_t)) pp, __uint32_t u)

functionle64enc

static __inline void le64enc(void *__sized_by(sizeof(__uint64_t)) pp, __uint64_t u)