bytesex.h: simplify the trivial case of cpu_to_le*()

In the trivial case, cpu_to_le*() can just be macros containing a
single cast.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
This commit is contained in:
H. Peter Anvin 2017-11-29 16:56:59 -08:00
parent 82025ea0e9
commit 8cdde2bbaa

View File

@ -130,13 +130,13 @@
#ifdef WORDS_LITTLEENDIAN
#ifndef HAVE_CPU_TO_LE16
static inline uint16_t cpu_to_le16(uint16_t v) { return v; }
# define cpu_to_le16(v) ((uint16_t)(v))
#endif
#ifndef HAVE_CPU_TO_LE32
static inline uint32_t cpu_to_le32(uint32_t v) { return v; }
# define cpu_to_le32(v) ((uint32_t)(v))
#endif
#ifndef HAVE_CPU_TO_LE64
static inline uint64_t cpu_to_le64(uint64_t v) { return v; }
# define cpu_to_le64(v) ((uint64_t)(v))
#endif
#elif defined(WORDS_BIGENDIAN)