summaryrefslogtreecommitdiff
path: root/lib/libc/endian/htole16.c
blob: 6689664ff3b56328c3ae50c4d27891b186bb6e68 (plain)
1
2
3
4
5
6
7
8
9
10
11
#include <endian.h> // for uint16_t, htole16
#include <stdint.h>

uint16_t htole16(uint16_t host_16bits)
{
#if __BYTE_ORDER == __BIG_ENDIAN
	return __builtin_bswap16(host_16bits);
#else
	return host_16bits;
#endif
}