diff options
Diffstat (limited to 'lib/libc/endian/htobe16.c')
| -rw-r--r-- | lib/libc/endian/htobe16.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/libc/endian/htobe16.c b/lib/libc/endian/htobe16.c new file mode 100644 index 00000000..bb66595f --- /dev/null +++ b/lib/libc/endian/htobe16.c @@ -0,0 +1,10 @@ +#include <endian.h> + +uint16_t htobe16(uint16_t host_16bits) +{ +#if __BYTE_ORDER == __LITTLE_ENDIAN + return __builtin_bswap16(host_16bits); +#else + return host_16bits; +#endif +} |
