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

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