summaryrefslogtreecommitdiff
path: root/include/endian.h
diff options
context:
space:
mode:
authorKacper <kacper@mail.openlinux.dev>2025-12-07 20:10:31 +0100
committerKacper <kacper@mail.openlinux.dev>2025-12-07 20:10:31 +0100
commitfc00c656c96528112d05cf0edf8631bd5eaea446 (patch)
treea6e0e6c588191a8bd1c64afc3b7a258e3e66c236 /include/endian.h
Add build system scaffolding and libc headers
Diffstat (limited to 'include/endian.h')
-rw-r--r--include/endian.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/endian.h b/include/endian.h
new file mode 100644
index 00000000..fd7d900f
--- /dev/null
+++ b/include/endian.h
@@ -0,0 +1,28 @@
+#ifndef __ENDIAN_H
+#define __ENDIAN_H
+
+#define BYTE_ORDER __BYTE_ORDER__
+#define LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
+#define BIG_ENDIAN __ORDER_BIG_ENDIAN__
+
+typedef __UINT16_TYPE__ uint16_t;
+typedef __UINT32_TYPE__ uint32_t;
+typedef __UINT64_TYPE__ uint64_t;
+
+uint16_t be16toh(uint16_t);
+uint32_t be32toh(uint32_t);
+uint64_t be64toh(uint64_t);
+
+uint16_t htobe16(uint16_t);
+uint32_t htobe32(uint32_t);
+uint64_t htobe64(uint64_t);
+
+uint16_t htole16(uint16_t);
+uint32_t htole32(uint32_t);
+uint64_t htole64(uint64_t);
+
+uint16_t le16toh(uint16_t);
+uint32_t le32toh(uint32_t);
+uint64_t le64toh(uint64_t);
+
+#endif