Embedded Artistry libc
C Standard Library Support for Bare-metal Systems
endian.h File Reference
#include <_endian.h>
#include <stdint.h>
Include dependency graph for endian.h:

Go to the source code of this file.

Macros

#define __LITTLE_ENDIAN   1234
 
#define __BIG_ENDIAN   4321
 
#define __PDP_ENDIAN   3412
 
#define BIG_ENDIAN   __BIG_ENDIAN
 
#define LITTLE_ENDIAN   __LITTLE_ENDIAN
 
#define PDP_ENDIAN   __PDP_ENDIAN
 
#define BYTE_ORDER   __BYTE_ORDER
 
#define __bswap16(x)   ((uint16_t)((((uint16_t)(x)&0xff00) >> 8) | (((uint16_t)(x)&0x00ff) << 8)))
 
#define __bswap32(x)
 
#define __bswap64(x)
 
#define htobe16(x)   (uint16_t)(x)
 
#define be16toh(x)   (uint16_t)(x)
 
#define betoh16(x)   (uint16_t)(x)
 
#define htobe32(x)   (uint32_t)(x)
 
#define be32toh(x)   (uint32_t)(x)
 
#define betoh32(x)   (uint32_t)(x)
 
#define htobe64(x)   (uint64_t)(x)
 
#define be64toh(x)   (uint64_t)(x)
 
#define betoh64(x)   (uint64_t)(x)
 
#define htole16(x)   __bswap16(x)
 
#define le16toh(x)   __bswap16(x)
 
#define letoh16(x)   __bswap16(x)
 
#define htole32(x)   __bswap32(x)
 
#define le32toh(x)   __bswap32(x)
 
#define letoh32(x)   __bswap32(x)
 
#define htole64(x)   __bswap64(x)
 
#define le64toh(x)   __bswap64(x)
 
#define letoh64(x)   __bswap64(x)
 
#define ntohl(x)   ((uint32_t)(x))
 
#define ntohs(x)   ((uint16_t)(x))
 
#define htonl(x)   ((uint32_t)(x))
 
#define htons(x)   ((uint16_t)(x))
 
#define ntohll(x)   ((uint64_t)(x))
 
#define htonll(x)   ((uint64_t)(x))
 
#define NTOHL(x)   (x)
 
#define NTOHS(x)   (x)
 
#define NTOHLL(x)   (x)
 
#define HTONL(x)   (x)
 
#define HTONS(x)   (x)
 
#define HTONLL(x)   (x)
 

Macro Definition Documentation

◆ __BIG_ENDIAN

#define __BIG_ENDIAN   4321

Definition at line 5 of file endian.h.

◆ __bswap16

#define __bswap16 (   x)    ((uint16_t)((((uint16_t)(x)&0xff00) >> 8) | (((uint16_t)(x)&0x00ff) << 8)))

Definition at line 17 of file endian.h.

◆ __bswap32

#define __bswap32 (   x)
Value:
((uint32_t)((((uint32_t)(x)&0xff000000) >> 24) | (((uint32_t)(x)&0x00ff0000) >> 8) | \
(((uint32_t)(x)&0x0000ff00) << 8) | (((uint32_t)(x)&0x000000ff) << 24)))

Definition at line 19 of file endian.h.

◆ __bswap64

#define __bswap64 (   x)
Value:
((uint64_t)((((uint64_t)(x)&0xff00000000000000ULL) >> 56) | \
(((uint64_t)(x)&0x00ff000000000000ULL) >> 40) | \
(((uint64_t)(x)&0x0000ff0000000000ULL) >> 24) | \
(((uint64_t)(x)&0x000000ff00000000ULL) >> 8) | \
(((uint64_t)(x)&0x00000000ff000000ULL) << 8) | \
(((uint64_t)(x)&0x0000000000ff0000ULL) << 24) | \
(((uint64_t)(x)&0x000000000000ff00ULL) << 40) | \
(((uint64_t)(x)&0x00000000000000ffULL) << 56)))

Definition at line 23 of file endian.h.

◆ __LITTLE_ENDIAN

#define __LITTLE_ENDIAN   1234

Definition at line 4 of file endian.h.

◆ __PDP_ENDIAN

#define __PDP_ENDIAN   3412

Definition at line 6 of file endian.h.

◆ be16toh

#define be16toh (   x)    (uint16_t)(x)

Definition at line 73 of file endian.h.

◆ be32toh

#define be32toh (   x)    (uint32_t)(x)

Definition at line 76 of file endian.h.

◆ be64toh

#define be64toh (   x)    (uint64_t)(x)

Definition at line 79 of file endian.h.

◆ betoh16

#define betoh16 (   x)    (uint16_t)(x)

Definition at line 74 of file endian.h.

◆ betoh32

#define betoh32 (   x)    (uint32_t)(x)

Definition at line 77 of file endian.h.

◆ betoh64

#define betoh64 (   x)    (uint64_t)(x)

Definition at line 80 of file endian.h.

◆ BIG_ENDIAN

#define BIG_ENDIAN   __BIG_ENDIAN

Definition at line 10 of file endian.h.

◆ BYTE_ORDER

#define BYTE_ORDER   __BYTE_ORDER

Definition at line 13 of file endian.h.

◆ htobe16

#define htobe16 (   x)    (uint16_t)(x)

Definition at line 72 of file endian.h.

◆ htobe32

#define htobe32 (   x)    (uint32_t)(x)

Definition at line 75 of file endian.h.

◆ htobe64

#define htobe64 (   x)    (uint64_t)(x)

Definition at line 78 of file endian.h.

◆ htole16

#define htole16 (   x)    __bswap16(x)

Definition at line 81 of file endian.h.

◆ htole32

#define htole32 (   x)    __bswap32(x)

Definition at line 84 of file endian.h.

◆ htole64

#define htole64 (   x)    __bswap64(x)

Definition at line 87 of file endian.h.

◆ htonl

#define htonl (   x)    ((uint32_t)(x))

Definition at line 94 of file endian.h.

◆ HTONL

#define HTONL (   x)    (x)

Definition at line 102 of file endian.h.

◆ htonll

#define htonll (   x)    ((uint64_t)(x))

Definition at line 97 of file endian.h.

◆ HTONLL

#define HTONLL (   x)    (x)

Definition at line 104 of file endian.h.

◆ htons

#define htons (   x)    ((uint16_t)(x))

Definition at line 95 of file endian.h.

◆ HTONS

#define HTONS (   x)    (x)

Definition at line 103 of file endian.h.

◆ le16toh

#define le16toh (   x)    __bswap16(x)

Definition at line 82 of file endian.h.

◆ le32toh

#define le32toh (   x)    __bswap32(x)

Definition at line 85 of file endian.h.

◆ le64toh

#define le64toh (   x)    __bswap64(x)

Definition at line 88 of file endian.h.

◆ letoh16

#define letoh16 (   x)    __bswap16(x)

Definition at line 83 of file endian.h.

◆ letoh32

#define letoh32 (   x)    __bswap32(x)

Definition at line 86 of file endian.h.

◆ letoh64

#define letoh64 (   x)    __bswap64(x)

Definition at line 89 of file endian.h.

◆ LITTLE_ENDIAN

#define LITTLE_ENDIAN   __LITTLE_ENDIAN

Definition at line 11 of file endian.h.

◆ ntohl

#define ntohl (   x)    ((uint32_t)(x))

Definition at line 92 of file endian.h.

◆ NTOHL

#define NTOHL (   x)    (x)

Definition at line 99 of file endian.h.

◆ ntohll

#define ntohll (   x)    ((uint64_t)(x))

Definition at line 96 of file endian.h.

◆ NTOHLL

#define NTOHLL (   x)    (x)

Definition at line 101 of file endian.h.

◆ ntohs

#define ntohs (   x)    ((uint16_t)(x))

Definition at line 93 of file endian.h.

◆ NTOHS

#define NTOHS (   x)    (x)

Definition at line 100 of file endian.h.

◆ PDP_ENDIAN

#define PDP_ENDIAN   __PDP_ENDIAN

Definition at line 12 of file endian.h.