55#undef GOT_UNALIGNED_SPECIALS
57#if defined(__BYTE_ORDER__) && defined(HAVE_BYTESWAP_H) && \
58 ! defined(IGNORE_FAST_LEBE)
60#if defined(__LITTLE_ENDIAN__) || (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
62#define GOT_UNALIGNED_SPECIALS 1
94 uint16_t u = bswap_16(val);
101 uint32_t u = bswap_32(val);
108 uint64_t u = bswap_64(val);
152#elif defined(__BIG_ENDIAN__) || (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
154#define GOT_UNALIGNED_SPECIALS 1
186 uint16_t u = bswap_16(val);
193 uint32_t u = bswap_32(val);
200 uint64_t u = bswap_64(val);
249#ifndef GOT_UNALIGNED_SPECIALS
258 return ((
const uint8_t *)p)[0] << 8 | ((
const uint8_t *)p)[1];
263 return ((
const uint8_t *)p)[0] << 24 | ((
const uint8_t *)p)[1] << 16 |
264 ((
const uint8_t *)p)[2] << 8 | ((
const uint8_t *)p)[3];
275 ((uint8_t *)p)[0] = (uint8_t)(val >> 8);
276 ((uint8_t *)p)[1] = (uint8_t)val;
294 return ((
const uint8_t *)p)[1] << 8 | ((
const uint8_t *)p)[0];
299 return ((
const uint8_t *)p)[3] << 24 | ((
const uint8_t *)p)[2] << 16 |
300 ((
const uint8_t *)p)[1] << 8 | ((
const uint8_t *)p)[0];
311 ((uint8_t *)p)[0] = val & 0xff;
312 ((uint8_t *)p)[1] = val >> 8;
336 return ((
const uint8_t *)p)[0] << 16 | ((
const uint8_t *)p)[1] << 8 |
337 ((
const uint8_t *)p)[2];
352 if ((num_bytes <= 0) || (num_bytes > (
int)
sizeof(uint64_t)))
355 const uint8_t * xp = (
const uint8_t *)p;
358 for (++xp; num_bytes > 1; ++xp, --num_bytes)
359 res = (res << 8) | *xp;
366 ((uint8_t *)p)[0] = (val >> 16) & 0xff;
367 ((uint8_t *)p)[1] = (val >> 8) & 0xff;
368 ((uint8_t *)p)[2] = val & 0xff;
382 ((
const uint8_t *)p)[2] << 16;
394 ((uint8_t *)p)[2] = (val >> 16) & 0xff;
395 ((uint8_t *)p)[1] = (val >> 8) & 0xff;
396 ((uint8_t *)p)[0] = val & 0xff;
402 ((uint8_t *)p)[5] = (val >> 40) & 0xff;
403 ((uint8_t *)p)[4] = (val >> 32) & 0xff;
404 ((uint8_t *)p)[3] = (val >> 24) & 0xff;
405 ((uint8_t *)p)[2] = (val >> 16) & 0xff;
406 ((uint8_t *)p)[1] = (val >> 8) & 0xff;
407 ((uint8_t *)p)[0] = val & 0xff;
415 if ((num_bytes <= 0) || (num_bytes > (
int)
sizeof(uint64_t)))
418 const uint8_t * xp = (
const uint8_t *)p + (num_bytes - 1);
421 for (--xp; num_bytes > 1; --xp, --num_bytes)
422 res = (res << 8) | *xp;
439 ((uint8_t *)p)[0] = (val >> 16) & 0xff;
440 ((uint8_t *)p)[1] = (val >> 8) & 0xff;
441 ((uint8_t *)p)[2] = val & 0xff;
466 ((uint8_t *)p)[2] = (val >> 16) & 0xff;
467 ((uint8_t *)p)[1] = (val >> 8) & 0xff;
468 ((uint8_t *)p)[0] = val & 0xff;
static void sg_put_unaligned_le48(uint64_t val, void *p)
static uint64_t sg_get_unaligned_le64(const void *p)
static void sg_put_unaligned_le32(uint32_t val, void *p)
static void sg_put_unaligned_be32(uint32_t val, void *p)
static void sg_put_unaligned_be16(uint16_t val, void *p)
static void sg_put_unaligned_le64(uint64_t val, void *p)
static uint32_t sg_get_unaligned_le32(const void *p)
static void sg_put_unaligned_be24(uint32_t val, void *p)
static uint64_t sg_get_unaligned_be64(const void *p)
static uint64_t sg_get_unaligned_le48(const void *p)
static uint64_t sg_get_unaligned_be(int num_bytes, const void *p)
static void sg_nz_put_unaligned_be16(uint16_t val, void *p)
static void sg_nz_put_unaligned_le24(uint32_t val, void *p)
static uint16_t sg_get_unaligned_be16(const void *p)
static uint32_t sg_get_unaligned_le24(const void *p)
static uint16_t sg_get_unaligned_le16(const void *p)
static void sg_nz_put_unaligned_be64(uint64_t val, void *p)
static uint32_t sg_get_unaligned_be24(const void *p)
static uint64_t sg_get_unaligned_be48(const void *p)
static void sg_nz_put_unaligned_le64(uint64_t val, void *p)
static uint32_t sg_get_unaligned_be32(const void *p)
static void sg_nz_put_unaligned_le32(uint32_t val, void *p)
static uint64_t sg_get_unaligned_le(int num_bytes, const void *p)
static void sg_nz_put_unaligned_le16(uint16_t val, void *p)
static void sg_put_unaligned_le16(uint16_t val, void *p)
static void sg_nz_put_unaligned_be24(uint32_t val, void *p)
static void sg_nz_put_unaligned_be32(uint32_t val, void *p)
static void sg_put_unaligned_le24(uint32_t val, void *p)
static void sg_put_unaligned_be64(uint64_t val, void *p)
static void sg_put_unaligned_be48(uint64_t val, void *p)