- assert (cnt > 0 && cnt < 64);
- assert (ofs + cnt <= 64);
- return (x >> ofs) & ((UINT64_C(1) << cnt) - 1);
-}
-
-/* Returns the 16-bit unsigned integer at P,
- which need not be aligned. */
-static inline uint16_t
-get_uint16 (const void *p)
-{
- uint16_t x;
- memcpy (&x, p, sizeof x);
- return x;
-}
-
-/* Returns the 32-bit unsigned integer at P,
- which need not be aligned. */
-static inline uint32_t
-get_uint32 (const void *p)
-{
- uint32_t x;
- memcpy (&x, p, sizeof x);
- return x;
-}
-
-/* Returns the 64-bit unsigned integer at P,
- which need not be aligned. */
-static inline uint64_t
-get_uint64 (const void *p)
-{
- uint64_t x;
- memcpy (&x, p, sizeof x);
- return x;
-}
-
-/* Stores 16-bit unsigned integer X at P,
- which need not be aligned. */
-static inline void
-put_uint16 (uint16_t x, void *p)
-{
- memcpy (p, &x, sizeof x);
-}
-
-/* Stores 32-bit unsigned integer X at P,
- which need not be aligned. */
-static inline void
-put_uint32 (uint32_t x, void *p)
-{
- memcpy (p, &x, sizeof x);
-}
-
-/* Stores 64-bit unsigned integer X at P,
- which need not be aligned. */
-static inline void
-put_uint64 (uint64_t x, void *p)
-{
- memcpy (p, &x, sizeof x);
-}
-
-/* Returns NATIVE converted to a form that, when stored in
- memory, will be in little-endian byte order. */
-static inline uint16_t
-native_to_le16 (uint16_t native)
-{
- return INTEGER_NATIVE == INTEGER_LSB_FIRST ? native : bswap_16 (native);
-}
-
-/* Returns NATIVE converted to a form that, when stored in
- memory, will be in big-endian byte order. */
-static inline uint16_t
-native_to_be16 (uint16_t native)
-{
- return INTEGER_NATIVE == INTEGER_MSB_FIRST ? native : bswap_16 (native);
-}
-
-/* Returns NATIVE converted to a form that, when stored in
- memory, will be in VAX-endian byte order. */
-static inline uint16_t
-native_to_vax16 (uint16_t native)
-{
- return native_to_le16 (native);
-}
-
-/* Returns NATIVE converted to a form that, when stored in
- memory, will be in little-endian byte order. */
-static inline uint32_t
-native_to_le32 (uint32_t native)
-{
- return INTEGER_NATIVE == INTEGER_LSB_FIRST ? native : bswap_32 (native);
-}
-
-/* Returns NATIVE converted to a form that, when stored in
- memory, will be in big-endian byte order. */
-static inline uint32_t
-native_to_be32 (uint32_t native)
-{
- return INTEGER_NATIVE == INTEGER_MSB_FIRST ? native : bswap_32 (native);