aboutsummaryrefslogtreecommitdiff
path: root/include/endian.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/endian.h')
-rw-r--r--include/endian.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/endian.h b/include/endian.h
new file mode 100644
index 00000000..0e9b6101
--- /dev/null
+++ b/include/endian.h
@@ -0,0 +1,8 @@
+#ifndef _WLR_ENDIAN_H
+#define _WLR_ENDIAN_H
+
+// https://stackoverflow.com/a/4240257
+
+#define little_endian() (((union { unsigned x; unsigned char c; }){1}).c)
+
+#endif