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

uint32_t htobe32(uint32_t host_32bits)
{
#if __BYTE_ORDER == __LITTLE_ENDIAN
	return __builtin_bswap32(host_32bits);
#else
	return host_32bits;
#endif
}