summaryrefslogtreecommitdiffstats
path: root/tools/include/nolibc/byteswap.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/include/nolibc/byteswap.h')
-rw-r--r--tools/include/nolibc/byteswap.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/include/nolibc/byteswap.h b/tools/include/nolibc/byteswap.h
new file mode 100644
index 000000000..45bbf9609
--- /dev/null
+++ b/tools/include/nolibc/byteswap.h
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: LGPL-2.1 OR MIT */
+/*
+ * Byte swapping for NOLIBC
+ * Copyright (C) 2026 Thomas Weißschuh <linux@weissschuh.net>
+ */
+
+/* make sure to include all global symbols */
+#include "nolibc.h"
+
+#ifndef _NOLIBC_BYTESWAP_H
+#define _NOLIBC_BYTESWAP_H
+
+#include "stdint.h"
+
+#include <linux/swab.h>
+
+#define bswap_16(_x) __swab16(_x)
+#define bswap_32(_x) __swab32(_x)
+#define bswap_64(_x) __swab64(_x)
+
+#endif /* _NOLIBC_BYTESWAP_H */