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

uint32_t htole32(uint32_t host_32bits)
{
#if __BYTE_ORDER == __BIG_ENDIAN
	return __builtin_bswap32(host_32bits);
#else
	return host_32bits;
#endif
}