diff --git a/src/gmio_core/endian.h b/src/gmio_core/endian.h index 4ed067f..1d3a615 100644 --- a/src/gmio_core/endian.h +++ b/src/gmio_core/endian.h @@ -25,27 +25,32 @@ /*! This enum identifies common endianness (byte order) of computer memory */ enum gmio_endianness { + /*! The least significant byte is stored at the lowest address. The other + * bytes follow in increasing order of significance */ GMIO_LITTLE_ENDIAN, + + /*! The most significant byte is stored at the lowest address. The other + * bytes follow in decreasing order of significance */ GMIO_BIG_ENDIAN, - GMIO_OTHER_ENDIAN -}; -typedef enum gmio_endianness gmio_endianness_t; + /*! Other (unknown) byte-order */ + GMIO_OTHER_ENDIAN, -/*! Constants for host endianness */ -enum { #ifdef GMIO_HOST_IS_BIG_ENDIAN GMIO_HOST_ENDIANNESS = GMIO_BIG_ENDIAN #else - /*! Defines the endianness(byte order) used by the host computer for storing - * data in memory. + /*! Defines the endianness(byte order) used by the host computer for + * storing data in memory. * - * It is set at configure-time to one of the value of gmio_endianness + * It is set at configure-time to either GMIO_LITTLE_ENDIAN or + * GMIO_BIG_ENDIAN */ GMIO_HOST_ENDIANNESS = GMIO_LITTLE_ENDIAN #endif }; +typedef enum gmio_endianness gmio_endianness_t; + GMIO_C_LINKAGE_BEGIN /*! Returns endianness (byte order) of the host's CPU architecture */ diff --git a/src/gmio_stl/stlb_read.c b/src/gmio_stl/stlb_read.c index 65f7702..9df1aa1 100644 --- a/src/gmio_stl/stlb_read.c +++ b/src/gmio_stl/stlb_read.c @@ -72,7 +72,7 @@ int gmio_stlb_read( const gmio_stlb_read_options_t* options) { /* Constants */ - const int byte_order = + const gmio_endianness_t byte_order = options != NULL ? options->byte_order : GMIO_HOST_ENDIANNESS; const uint32_t max_facet_count_per_read = trsf != NULL ? diff --git a/src/gmio_stl/stlb_write.c b/src/gmio_stl/stlb_write.c index 7cca05e..7b95c59 100644 --- a/src/gmio_stl/stlb_write.c +++ b/src/gmio_stl/stlb_write.c @@ -73,7 +73,7 @@ int gmio_stlb_write( const gmio_stlb_write_options_t* options) { /* Constants */ - const int byte_order = + const gmio_endianness_t byte_order = options != NULL ? options->byte_order : GMIO_HOST_ENDIANNESS; const uint8_t* header_data = options != NULL ? options->header_data : NULL;