gmio_core: make GMIO_HOST_ENDIANNESS a value of gmio_endianness

This commit is contained in:
Hugues Delorme 2015-03-30 09:15:20 +02:00
parent e15e3f8142
commit d73515e9fe
3 changed files with 15 additions and 10 deletions

View File

@ -25,27 +25,32 @@
/*! This enum identifies common endianness (byte order) of computer memory */ /*! This enum identifies common endianness (byte order) of computer memory */
enum gmio_endianness 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, 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_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 #ifdef GMIO_HOST_IS_BIG_ENDIAN
GMIO_HOST_ENDIANNESS = GMIO_BIG_ENDIAN GMIO_HOST_ENDIANNESS = GMIO_BIG_ENDIAN
#else #else
/*! Defines the endianness(byte order) used by the host computer for storing /*! Defines the endianness(byte order) used by the host computer for
* data in memory. * 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 GMIO_HOST_ENDIANNESS = GMIO_LITTLE_ENDIAN
#endif #endif
}; };
typedef enum gmio_endianness gmio_endianness_t;
GMIO_C_LINKAGE_BEGIN GMIO_C_LINKAGE_BEGIN
/*! Returns endianness (byte order) of the host's CPU architecture */ /*! Returns endianness (byte order) of the host's CPU architecture */

View File

@ -72,7 +72,7 @@ int gmio_stlb_read(
const gmio_stlb_read_options_t* options) const gmio_stlb_read_options_t* options)
{ {
/* Constants */ /* Constants */
const int byte_order = const gmio_endianness_t byte_order =
options != NULL ? options->byte_order : GMIO_HOST_ENDIANNESS; options != NULL ? options->byte_order : GMIO_HOST_ENDIANNESS;
const uint32_t max_facet_count_per_read = const uint32_t max_facet_count_per_read =
trsf != NULL ? trsf != NULL ?

View File

@ -73,7 +73,7 @@ int gmio_stlb_write(
const gmio_stlb_write_options_t* options) const gmio_stlb_write_options_t* options)
{ {
/* Constants */ /* Constants */
const int byte_order = const gmio_endianness_t byte_order =
options != NULL ? options->byte_order : GMIO_HOST_ENDIANNESS; options != NULL ? options->byte_order : GMIO_HOST_ENDIANNESS;
const uint8_t* header_data = const uint8_t* header_data =
options != NULL ? options->header_data : NULL; options != NULL ? options->header_data : NULL;