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

uint16_t htobe16(uint16_t host_16bits)
{
#if __BYTE_ORDER == __LITTLE_ENDIAN
	return __builtin_bswap16(host_16bits);
#else
	return host_16bits;
#endif
}