libgphoto2 photo camera library (libgphoto2) Internals  2.5.26
gphoto2-endian.h File Reference
#include <_stdint.h>

Go to the source code of this file.

Macros

#define swap16(x)   ((uint16_t)(((x) << 8) | ((uint16_t)(x) >> 8)))
 
#define swap32(x)
 
#define swap64(x)
 
#define htobe16(x)   swap16(x)
 
#define htobe32(x)   swap32(x)
 
#define be16toh(x)   htobe16(x)
 
#define be32toh(x)   htobe32(x)
 
#define HTOBE16(x)   (x) = htobe16(x)
 
#define HTOBE32(x)   (x) = htobe32(x)
 
#define BE32TOH(x)   (x) = be32toh(x)
 
#define BE16TOH(x)   (x) = be16toh(x)
 
#define htole16(x)   (x)
 
#define htole32(x)   (x)
 
#define htole64(x)   (x)
 
#define le16toh(x)   (x)
 
#define le32toh(x)   (x)
 
#define le64toh(x)   (x)
 
#define HTOLE16(x)   (void) (x)
 
#define HTOLE32(x)   (void) (x)
 
#define HTOLE64(x)   (void) (x)
 
#define LE16TOH(x)   (void) (x)
 
#define LE32TOH(x)   (void) (x)
 
#define LE64TOH(x)   (void) (x)
 
#define htobe64(x)   swap64(x)
 
#define be64toh(x)   swap64(x)
 
#define HTOBE64(x)   (x) = htobe64(x)
 
#define BE64TOH(x)   (x) = be64toh(x)
 
#define be16atoh(x)   be16toh(*(uint16_t*)(x))
 
#define be32atoh(x)   be32toh(*(uint32_t*)(x))
 
#define be64atoh(x)   be64toh(*(uint64_t*)(x))
 
#define le16atoh(x)   le16toh(*(uint16_t*)(x))
 
#define le32atoh(x)   le32toh(*(uint32_t*)(x))
 
#define le64atoh(x)   le64toh(*(uint64_t*)(x))
 
#define htobe16a(a, x)   *(uint16_t*)(a) = htobe16(x)
 
#define htobe32a(a, x)   *(uint32_t*)(a) = htobe32(x)
 
#define htobe64a(a, x)   *(uint64_t*)(a) = htobe64(x)
 
#define htole16a(a, x)   *(uint16_t*)(a) = htole16(x)
 
#define htole32a(a, x)   *(uint32_t*)(a) = htole32(x)
 
#define htole64a(a, x)   *(uint64_t*)(a) = htole64(x)
 

Macro Definition Documentation

◆ be16atoh

#define be16atoh (   x)    be16toh(*(uint16_t*)(x))

Definition at line 130 of file gphoto2-endian.h.

◆ be16toh

#define be16toh (   x)    htobe16(x)

Definition at line 69 of file gphoto2-endian.h.

◆ BE16TOH

#define BE16TOH (   x)    (x) = be16toh(x)

Definition at line 78 of file gphoto2-endian.h.

◆ be32atoh

#define be32atoh (   x)    be32toh(*(uint32_t*)(x))

Definition at line 133 of file gphoto2-endian.h.

◆ be32toh

#define be32toh (   x)    htobe32(x)

Definition at line 72 of file gphoto2-endian.h.

◆ BE32TOH

#define BE32TOH (   x)    (x) = be32toh(x)

Definition at line 77 of file gphoto2-endian.h.

◆ be64atoh

#define be64atoh (   x)    be64toh(*(uint64_t*)(x))

Definition at line 136 of file gphoto2-endian.h.

◆ be64toh

#define be64toh (   x)    swap64(x)

Definition at line 112 of file gphoto2-endian.h.

◆ BE64TOH

#define BE64TOH (   x)    (x) = be64toh(x)

Definition at line 116 of file gphoto2-endian.h.

◆ htobe16

#define htobe16 (   x)    swap16(x)

Definition at line 53 of file gphoto2-endian.h.

◆ HTOBE16

#define HTOBE16 (   x)    (x) = htobe16(x)

Definition at line 75 of file gphoto2-endian.h.

◆ htobe16a

#define htobe16a (   a,
 
)    *(uint16_t*)(a) = htobe16(x)

Definition at line 149 of file gphoto2-endian.h.

◆ htobe32

#define htobe32 (   x)    swap32(x)

Definition at line 64 of file gphoto2-endian.h.

◆ HTOBE32

#define HTOBE32 (   x)    (x) = htobe32(x)

Definition at line 76 of file gphoto2-endian.h.

◆ htobe32a

#define htobe32a (   a,
 
)    *(uint32_t*)(a) = htobe32(x)

Definition at line 152 of file gphoto2-endian.h.

◆ htobe64

#define htobe64 (   x)    swap64(x)

Definition at line 109 of file gphoto2-endian.h.

◆ HTOBE64

#define HTOBE64 (   x)    (x) = htobe64(x)

Definition at line 115 of file gphoto2-endian.h.

◆ htobe64a

#define htobe64a (   a,
 
)    *(uint64_t*)(a) = htobe64(x)

Definition at line 155 of file gphoto2-endian.h.

◆ htole16

#define htole16 (   x)    (x)

Definition at line 82 of file gphoto2-endian.h.

◆ HTOLE16

#define HTOLE16 (   x)    (void) (x)

Definition at line 100 of file gphoto2-endian.h.

◆ htole16a

#define htole16a (   a,
 
)    *(uint16_t*)(a) = htole16(x)

Definition at line 158 of file gphoto2-endian.h.

◆ htole32

#define htole32 (   x)    (x)

Definition at line 85 of file gphoto2-endian.h.

◆ HTOLE32

#define HTOLE32 (   x)    (void) (x)

Definition at line 101 of file gphoto2-endian.h.

◆ htole32a

#define htole32a (   a,
 
)    *(uint32_t*)(a) = htole32(x)

Definition at line 161 of file gphoto2-endian.h.

◆ htole64

#define htole64 (   x)    (x)

Definition at line 88 of file gphoto2-endian.h.

◆ HTOLE64

#define HTOLE64 (   x)    (void) (x)

Definition at line 102 of file gphoto2-endian.h.

◆ htole64a

#define htole64a (   a,
 
)    *(uint64_t*)(a) = htole64(x)

Definition at line 164 of file gphoto2-endian.h.

◆ le16atoh

#define le16atoh (   x)    le16toh(*(uint16_t*)(x))

Definition at line 139 of file gphoto2-endian.h.

◆ le16toh

#define le16toh (   x)    (x)

Definition at line 91 of file gphoto2-endian.h.

◆ LE16TOH

#define LE16TOH (   x)    (void) (x)

Definition at line 103 of file gphoto2-endian.h.

◆ le32atoh

#define le32atoh (   x)    le32toh(*(uint32_t*)(x))

Definition at line 142 of file gphoto2-endian.h.

◆ le32toh

#define le32toh (   x)    (x)

Definition at line 94 of file gphoto2-endian.h.

◆ LE32TOH

#define LE32TOH (   x)    (void) (x)

Definition at line 104 of file gphoto2-endian.h.

◆ le64atoh

#define le64atoh (   x)    le64toh(*(uint64_t*)(x))

Definition at line 145 of file gphoto2-endian.h.

◆ le64toh

#define le64toh (   x)    (x)

Definition at line 97 of file gphoto2-endian.h.

◆ LE64TOH

#define LE64TOH (   x)    (void) (x)

Definition at line 105 of file gphoto2-endian.h.

◆ swap16

#define swap16 (   x)    ((uint16_t)(((x) << 8) | ((uint16_t)(x) >> 8)))

Definition at line 14 of file gphoto2-endian.h.

◆ swap32

#define swap32 (   x)
Value:
((uint32_t)((((uint32_t)(x) << 24) & 0xff000000UL) | \
(((uint32_t)(x) << 8) & 0x00ff0000UL) | \
(((x) >> 8) & 0x0000ff00UL) | \
(((x) >> 24) & 0x000000ffUL)))

Definition at line 15 of file gphoto2-endian.h.

◆ swap64

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

Definition at line 21 of file gphoto2-endian.h.