gphoto2-endian.h

00001 /* This file is generated automatically by configure */
00002 /* It is valid only for the system type i686-unknown-kfreebsd8.1-gnu */
00003 
00004 #ifndef __BYTEORDER_H
00005 #define __BYTEORDER_H
00006 
00007 /* extended byte swapping macros are already available */
00008 #include <machine/endian.h>
00009 
00010 /* Define generic byte swapping functions */
00011 #include <byteswap.h>
00012 #define swap16(x) bswap_16(x)
00013 #define swap32(x) bswap_32(x)
00014 #define swap64(x) bswap_64(x)
00015 
00016 /* Define the C99 standard length-specific integer types */
00017 #include <_stdint.h>
00018 
00019 /* Here are some macros to create integers from a byte array */
00020 /* These are used to get and put integers from/into a uint8_t array */
00021 /* with a specific endianness.  This is the most portable way to generate */
00022 /* and read messages to a network or serial device.  Each member of a */
00023 /* packet structure must be handled separately. */
00024 
00025 /* The i386 and compatibles can handle unaligned memory access, */
00026 /* so use the optimized macros above to do this job */
00027 #ifndef be16atoh
00028 # define be16atoh(x)     be16toh(*(uint16_t*)(x))
00029 #endif
00030 #ifndef be32atoh
00031 # define be32atoh(x)     be32toh(*(uint32_t*)(x))
00032 #endif
00033 #ifndef be64atoh
00034 # define be64atoh(x)     be64toh(*(uint64_t*)(x))
00035 #endif
00036 #ifndef le16atoh
00037 # define le16atoh(x)     le16toh(*(uint16_t*)(x))
00038 #endif
00039 #ifndef le32atoh
00040 # define le32atoh(x)     le32toh(*(uint32_t*)(x))
00041 #endif
00042 #ifndef le64atoh
00043 # define le64atoh(x)     le64toh(*(uint64_t*)(x))
00044 #endif
00045 
00046 #ifndef htob16a
00047 # define htobe16a(a,x)   *(uint16_t*)(a) = htobe16(x)
00048 #endif
00049 #ifndef htobe32a
00050 # define htobe32a(a,x)   *(uint32_t*)(a) = htobe32(x)
00051 #endif
00052 #ifndef htobe64a
00053 # define htobe64a(a,x)   *(uint64_t*)(a) = htobe64(x)
00054 #endif
00055 #ifndef htole16a
00056 # define htole16a(a,x)   *(uint16_t*)(a) = htole16(x)
00057 #endif
00058 #ifndef htole32a
00059 # define htole32a(a,x)   *(uint32_t*)(a) = htole32(x)
00060 #endif
00061 #ifndef htole64a
00062 # define htole64a(a,x)   *(uint64_t*)(a) = htole64(x)
00063 #endif
00064 
00065 #endif /*__BYTEORDER_H*/