xref: /linux/tools/include/nolibc/byteswap.h (revision 0fc8f6200d2313278fbf4539bbab74677c685531)
1*ce834c9cSThomas Weißschuh /* SPDX-License-Identifier: LGPL-2.1 OR MIT */
2*ce834c9cSThomas Weißschuh /*
3*ce834c9cSThomas Weißschuh  * Byte swapping for NOLIBC
4*ce834c9cSThomas Weißschuh  * Copyright (C) 2026 Thomas Weißschuh <linux@weissschuh.net>
5*ce834c9cSThomas Weißschuh  */
6*ce834c9cSThomas Weißschuh 
7*ce834c9cSThomas Weißschuh /* make sure to include all global symbols */
8*ce834c9cSThomas Weißschuh #include "nolibc.h"
9*ce834c9cSThomas Weißschuh 
10*ce834c9cSThomas Weißschuh #ifndef _NOLIBC_BYTESWAP_H
11*ce834c9cSThomas Weißschuh #define _NOLIBC_BYTESWAP_H
12*ce834c9cSThomas Weißschuh 
13*ce834c9cSThomas Weißschuh #include "stdint.h"
14*ce834c9cSThomas Weißschuh 
15*ce834c9cSThomas Weißschuh #include <linux/swab.h>
16*ce834c9cSThomas Weißschuh 
17*ce834c9cSThomas Weißschuh #define bswap_16(_x) __swab16(_x)
18*ce834c9cSThomas Weißschuh #define bswap_32(_x) __swab32(_x)
19*ce834c9cSThomas Weißschuh #define bswap_64(_x) __swab64(_x)
20*ce834c9cSThomas Weißschuh 
21*ce834c9cSThomas Weißschuh #endif /* _NOLIBC_BYTESWAP_H */
22