libcdio  0.90
Defines
bytesex.h File Reference

Generic Byte-swapping routines. More...

#include <cdio/types.h>
#include <cdio/bytesex_asm.h>
#include <cdio/logging.h>

Go to the source code of this file.

Defines

#define UINT16_SWAP_LE_BE_C(val)
#define UINT32_SWAP_LE_BE_C(val)
#define UINT64_SWAP_LE_BE_C(val)
#define UINT16_SWAP_LE_BE   UINT16_SWAP_LE_BE_C
#define UINT32_SWAP_LE_BE   UINT32_SWAP_LE_BE_C
#define UINT64_SWAP_LE_BE   UINT64_SWAP_LE_BE_C
#define UINT8_TO_BE(val)   ((uint8_t) (val))
#define UINT8_TO_LE(val)   ((uint8_t) (val))
#define UINT16_TO_BE(val)   ((uint16_t) UINT16_SWAP_LE_BE(val))
#define UINT16_TO_LE(val)   ((uint16_t) (val))
#define UINT32_TO_BE(val)   ((uint32_t) UINT32_SWAP_LE_BE(val))
#define UINT32_TO_LE(val)   ((uint32_t) (val))
#define UINT64_TO_BE(val)   ((uint64_t) UINT64_SWAP_LE_BE(val))
#define UINT64_TO_LE(val)   ((uint64_t) (val))
#define UINT8_FROM_BE(val)   (UINT8_TO_BE (val))
#define UINT8_FROM_LE(val)   (UINT8_TO_LE (val))
#define UINT16_FROM_BE(val)   (UINT16_TO_BE (val))
#define UINT16_FROM_LE(val)   (UINT16_TO_LE (val))
#define UINT32_FROM_BE(val)   (UINT32_TO_BE (val))
#define UINT32_FROM_LE(val)   (UINT32_TO_LE (val))
#define UINT64_FROM_BE(val)   (UINT64_TO_BE (val))
#define UINT64_FROM_LE(val)   (UINT64_TO_LE (val))
#define CVT_TO_FUNC(bits)
#define uint8_from_be(val)   (uint8_to_be (val))
#define uint8_from_le(val)   (uint8_to_le (val))
#define uint16_from_be(val)   (uint16_to_be (val))
#define uint16_from_le(val)   (uint16_to_le (val))
#define uint32_from_be(val)   (uint32_to_be (val))
#define uint32_from_le(val)   (uint32_to_le (val))
#define uint64_from_be(val)   (uint64_to_be (val))
#define uint64_from_le(val)   (uint64_to_le (val))
#define to_711(i)   uint8_to_le(i)
#define from_711(i)   uint8_from_le(i)
#define to_721(i)   uint16_to_le(i)
#define from_721(i)   uint16_from_le(i)
#define to_722(i)   uint16_to_be(i)
#define from_722(i)   uint16_from_be(i)
#define to_731(i)   uint32_to_le(i)
#define from_731(i)   uint32_from_le(i)
#define to_732(i)   uint32_to_be(i)
#define from_732(i)   uint32_from_be(i)

Detailed Description

Generic Byte-swapping routines.

Note: this header will is slated to get removed and libcdio will use glib.h routines instead.


Define Documentation

#define CVT_TO_FUNC (   bits)
Value:
static CDIO_INLINE uint ## bits ## _t \
 uint ## bits ## _to_be (uint ## bits ## _t val) \
 { return UINT ## bits ## _TO_BE (val); } \
 static CDIO_INLINE uint ## bits ## _t \
 uint ## bits ## _to_le (uint ## bits ## _t val) \
 { return UINT ## bits ## _TO_LE (val); } \

converter function template

#define from_711 (   i)    uint8_from_le(i)

Convert from ISO 9660 7.1.1 format to uint8_t

#define from_721 (   i)    uint16_from_le(i)

Convert from ISO 9660 7.2.1 format to uint16_t

#define from_722 (   i)    uint16_from_be(i)

Convert from ISO 9660 7.2.2 format to uint16_t

#define from_731 (   i)    uint32_from_le(i)

Convert from ISO 9660 7.3.1 format to uint32_t

#define from_732 (   i)    uint32_from_be(i)

Convert from ISO 9660 7.3.2 format to uint32_t

#define to_711 (   i)    uint8_to_le(i)

ISO9660-related field conversion routines Convert from uint8_t to ISO 9660 7.1.1 format

#define to_721 (   i)    uint16_to_le(i)

Convert from uint16_t to ISO 9669 7.2.1 format

#define to_722 (   i)    uint16_to_be(i)

Convert from uint16_t to ISO 9669 7.2.2 format

#define to_731 (   i)    uint32_to_le(i)

Convert from uint16_t to ISO 9669 7.3.1 format

#define to_732 (   i)    uint32_to_be(i)

Convert from uint32_t to ISO 9669 7.3.2 format

#define UINT16_FROM_BE (   val)    (UINT16_TO_BE (val))
#define uint16_from_be (   val)    (uint16_to_be (val))
#define UINT16_FROM_LE (   val)    (UINT16_TO_LE (val))
#define uint16_from_le (   val)    (uint16_to_le (val))
#define UINT16_SWAP_LE_BE_C (   val)
Value:
((uint16_t) ( \
    (((uint16_t) (val) & (uint16_t) 0x00ffU) << 8) | \
    (((uint16_t) (val) & (uint16_t) 0xff00U) >> 8)))

16-bit big-endian to little-endian

#define UINT16_TO_BE (   val)    ((uint16_t) UINT16_SWAP_LE_BE(val))
#define UINT16_TO_LE (   val)    ((uint16_t) (val))
#define UINT32_FROM_BE (   val)    (UINT32_TO_BE (val))
#define uint32_from_be (   val)    (uint32_to_be (val))
#define UINT32_FROM_LE (   val)    (UINT32_TO_LE (val))
#define uint32_from_le (   val)    (uint32_to_le (val))
#define UINT32_SWAP_LE_BE_C (   val)
Value:
((uint32_t) ( \
    (((uint32_t) (val) & (uint32_t) 0x000000ffU) << 24) | \
    (((uint32_t) (val) & (uint32_t) 0x0000ff00U) <<  8) | \
    (((uint32_t) (val) & (uint32_t) 0x00ff0000U) >>  8) | \
    (((uint32_t) (val) & (uint32_t) 0xff000000U) >> 24)))

32-bit big-endian to little-endian

#define UINT32_TO_BE (   val)    ((uint32_t) UINT32_SWAP_LE_BE(val))
#define UINT32_TO_LE (   val)    ((uint32_t) (val))
#define UINT64_FROM_BE (   val)    (UINT64_TO_BE (val))
#define uint64_from_be (   val)    (uint64_to_be (val))
#define UINT64_FROM_LE (   val)    (UINT64_TO_LE (val))
#define uint64_from_le (   val)    (uint64_to_le (val))
#define UINT64_SWAP_LE_BE_C (   val)
Value:
((uint64_t) ( \
    (((uint64_t) (val) & (uint64_t) UINT64_C(0x00000000000000ff)) << 56) | \
    (((uint64_t) (val) & (uint64_t) UINT64_C(0x000000000000ff00)) << 40) | \
    (((uint64_t) (val) & (uint64_t) UINT64_C(0x0000000000ff0000)) << 24) | \
    (((uint64_t) (val) & (uint64_t) UINT64_C(0x00000000ff000000)) <<  8) | \
    (((uint64_t) (val) & (uint64_t) UINT64_C(0x000000ff00000000)) >>  8) | \
    (((uint64_t) (val) & (uint64_t) UINT64_C(0x0000ff0000000000)) >> 24) | \
    (((uint64_t) (val) & (uint64_t) UINT64_C(0x00ff000000000000)) >> 40) | \
    (((uint64_t) (val) & (uint64_t) UINT64_C(0xff00000000000000)) >> 56)))

64-bit big-endian to little-endian

#define UINT64_TO_BE (   val)    ((uint64_t) UINT64_SWAP_LE_BE(val))
#define UINT64_TO_LE (   val)    ((uint64_t) (val))
#define UINT8_FROM_BE (   val)    (UINT8_TO_BE (val))

symmetric conversions

#define uint8_from_be (   val)    (uint8_to_be (val))
#define UINT8_FROM_LE (   val)    (UINT8_TO_LE (val))
#define uint8_from_le (   val)    (uint8_to_le (val))
#define UINT8_TO_BE (   val)    ((uint8_t) (val))
#define UINT8_TO_LE (   val)    ((uint8_t) (val))