aboutsummaryrefslogtreecommitdiff
path: root/endian.h
blob: 6ebda832fa60ea37ab695f8067f7ae77bdff84dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#ifndef SAND_LEEK_ENDIAN_H
#define SAND_LEEK_ENDIAN_H

#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
# define sl_htobe32(x) (x)
#else
# define sl_htobe32(x) (((x & 0x000000FF) << 24) | \
                       ((x & 0xFF000000) >> 24)) | \
                       ((x & 0x0000FF00) << 8) | \
                       ((x & 0x00FF0000) >> 8)
#endif

#endif /* ifndef SAND_LEEK_ENDIAN_H */