libmtp  1.1.10
gphoto2-endian.h
1 /* This file is generated automatically by configure */
2 /* It is valid only for the system type i386-unknown-openbsd5.9 */
3 
4 #ifndef __BYTEORDER_H
5 #define __BYTEORDER_H
6 
7 /* extended byte swapping macros are already available */
8 #include <machine/endian.h>
9 
10 /* swap32 and swap16 are defined in machine/endian.h */
11 
12 /* Define the C99 standard length-specific integer types */
13 #include <_stdint.h>
14 
15 /* Here are some macros to create integers from a byte array */
16 /* These are used to get and put integers from/into a uint8_t array */
17 /* with a specific endianness. This is the most portable way to generate */
18 /* and read messages to a network or serial device. Each member of a */
19 /* packet structure must be handled separately. */
20 
21 /* The i386 and compatibles can handle unaligned memory access, */
22 /* so use the optimized macros above to do this job */
23 #ifndef be16atoh
24 # define be16atoh(x) be16toh(*(uint16_t*)(x))
25 #endif
26 #ifndef be32atoh
27 # define be32atoh(x) be32toh(*(uint32_t*)(x))
28 #endif
29 #ifndef be64atoh
30 # define be64atoh(x) be64toh(*(uint64_t*)(x))
31 #endif
32 #ifndef le16atoh
33 # define le16atoh(x) le16toh(*(uint16_t*)(x))
34 #endif
35 #ifndef le32atoh
36 # define le32atoh(x) le32toh(*(uint32_t*)(x))
37 #endif
38 #ifndef le64atoh
39 # define le64atoh(x) le64toh(*(uint64_t*)(x))
40 #endif
41 
42 #ifndef htob16a
43 # define htobe16a(a,x) *(uint16_t*)(a) = htobe16(x)
44 #endif
45 #ifndef htobe32a
46 # define htobe32a(a,x) *(uint32_t*)(a) = htobe32(x)
47 #endif
48 #ifndef htobe64a
49 # define htobe64a(a,x) *(uint64_t*)(a) = htobe64(x)
50 #endif
51 #ifndef htole16a
52 # define htole16a(a,x) *(uint16_t*)(a) = htole16(x)
53 #endif
54 #ifndef htole32a
55 # define htole32a(a,x) *(uint32_t*)(a) = htole32(x)
56 #endif
57 #ifndef htole64a
58 # define htole64a(a,x) *(uint64_t*)(a) = htole64(x)
59 #endif
60 
61 #endif /*__BYTEORDER_H*/