summaryrefslogtreecommitdiff
path: root/src/unaligned.h
diff options
context:
space:
mode:
authorSteven Fuller <relnev@icculus.org>2017-05-05 12:00:00 +0200
committerPatryk Obara <dreamer.tan@gmail.com>2019-08-20 03:51:51 +0200
commit5673c1665a2c6d7fdaf1a20d554bb135a20c7bc8 (patch)
treeccf08c484f14d7c5e95fa7f645db2014d61ebb78 /src/unaligned.h
parent0de664d0a886bcda45a0cd05551b6896c5c46ed0 (diff)
Import icculus.org release (2017-05-05)
Diffstat (limited to 'src/unaligned.h')
-rw-r--r--src/unaligned.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/unaligned.h b/src/unaligned.h
new file mode 100644
index 0000000..a0a8594
--- /dev/null
+++ b/src/unaligned.h
@@ -0,0 +1,29 @@
+#ifndef UNALIGNED_H
+#define UNALIGNED_H
+
+// Anything using these types is not alignment and endian clean.
+
+#if EMSCRIPTEN
+#include <emscripten.h>
+
+typedef emscripten_align1_short unaligned_s16;
+typedef emscripten_align1_int unaligned_s32;
+typedef emscripten_align1_short unaligned_u16;
+typedef emscripten_align1_int unaligned_u32;
+typedef emscripten_align1_float unaligned_f32;
+typedef emscripten_align1_double unaligned_f64;
+
+#else
+
+#include <stdint.h>
+
+typedef int16_t unaligned_s16;
+typedef int32_t unaligned_s32;
+typedef uint16_t unaligned_u16;
+typedef uint32_t unaligned_u32;
+typedef float unaligned_f32;
+typedef double unaligned_f64;
+
+#endif
+
+#endif