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)   ((uint16_t)(((x)[0]<<8)|(x)[1]))
 
#define be32atoh(x)   ((uint32_t)(((x)[0]<<24)|((x)[1]<<16)|((x)[2]<<8)|(x)[3]))
 
#define be64atoh_x(x, off, shift)   (((uint64_t)((x)[off]))<<shift)
 
#define be64atoh(x)
 
#define le16atoh(x)   ((uint16_t)(((x)[1]<<8)|(x)[0]))
 
#define le32atoh(x)   ((uint32_t)(((x)[3]<<24)|((x)[2]<<16)|((x)[1]<<8)|(x)[0]))
 
#define le64atoh_x(x, off, shift)   (((uint64_t)(x)[off])<<shift)
 
#define le64atoh(x)
 
#define htobe16a(a, x)   (a)[0]=(uint8_t)((x)>>8), (a)[1]=(uint8_t)(x)
 
#define htobe32a(a, x)
 
#define htobe64a(a, x)
 
#define htole16a(a, x)   (a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x)
 
#define htole32a(a, x)
 
#define htole64a(a, x)
 

Macro Definition Documentation

◆ be16atoh

#define be16atoh (   x)    ((uint16_t)(((x)[0]<<8)|(x)[1]))

Definition at line 128 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)    ((uint32_t)(((x)[0]<<24)|((x)[1]<<16)|((x)[2]<<8)|(x)[3]))

Definition at line 129 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)
Value:
((uint64_t)(be64atoh_x(x,0,56)|be64atoh_x(x,1,48)|be64atoh_x(x,2,40)| \
be64atoh_x(x,3,32)|be64atoh_x(x,4,24)|be64atoh_x(x,5,16)|be64atoh_x(x,6,8)|((x)[7])))
#define be64atoh_x(x, off, shift)

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

◆ be64atoh_x

#define be64atoh_x (   x,
  off,
  shift 
)    (((uint64_t)((x)[off]))<<shift)

Definition at line 130 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,
 
)    (a)[0]=(uint8_t)((x)>>8), (a)[1]=(uint8_t)(x)

Definition at line 139 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,
 
)
Value:
(a)[0]=(uint8_t)((x)>>24), (a)[1]=(uint8_t)((x)>>16), \
(a)[2]=(uint8_t)((x)>>8), (a)[3]=(uint8_t)(x)

Definition at line 140 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,
 
)
Value:
(a)[0]=(uint8_t)((x)>>56), (a)[1]=(uint8_t)((x)>>48), \
(a)[2]=(uint8_t)((x)>>40), (a)[3]=(uint8_t)((x)>>32), \
(a)[4]=(uint8_t)((x)>>24), (a)[5]=(uint8_t)((x)>>16), \
(a)[6]=(uint8_t)((x)>>8), (a)[7]=(uint8_t)(x)

Definition at line 142 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,
 
)    (a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x)

Definition at line 146 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,
 
)
Value:
(a)[3]=(uint8_t)((x)>>24), (a)[2]=(uint8_t)((x)>>16), \
(a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x)

Definition at line 147 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,
 
)
Value:
(a)[7]=(uint8_t)((x)>>56), (a)[6]=(uint8_t)((x)>>48), \
(a)[5]=(uint8_t)((x)>>40), (a)[4]=(uint8_t)((x)>>32), \
(a)[3]=(uint8_t)((x)>>24), (a)[2]=(uint8_t)((x)>>16), \
(a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x)

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

◆ le16atoh

#define le16atoh (   x)    ((uint16_t)(((x)[1]<<8)|(x)[0]))

Definition at line 133 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)    ((uint32_t)(((x)[3]<<24)|((x)[2]<<16)|((x)[1]<<8)|(x)[0]))

Definition at line 134 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)
Value:
((uint64_t)(le64atoh_x(x,7,56)|le64atoh_x(x,6,48)|le64atoh_x(x,5,40)| \
le64atoh_x(x,4,32)|le64atoh_x(x,3,24)|le64atoh_x(x,2,16)|le64atoh_x(x,1,8)|((x)[0])))
#define le64atoh_x(x, off, shift)

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

◆ le64atoh_x

#define le64atoh_x (   x,
  off,
  shift 
)    (((uint64_t)(x)[off])<<shift)

Definition at line 135 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.