diff nuklear_ui/nuklear.h @ 1843:13abdc98379e mame_interp

Get Android build target working on mame_interp branch
author Michael Pavone <pavone@retrodev.com>
date Thu, 18 Apr 2019 22:06:47 -0700
parents c5c022c7aa54
children 374a5ae694e8
line wrap: on
line diff
--- a/nuklear_ui/nuklear.h	Sun Apr 14 23:38:02 2019 -0700
+++ b/nuklear_ui/nuklear.h	Thu Apr 18 22:06:47 2019 -0700
@@ -5557,23 +5557,35 @@
 {
     /* 32-Bit MurmurHash3: https://code.google.com/p/smhasher/wiki/MurmurHash3*/
     #define NK_ROTL(x,r) ((x) << (r) | ((x) >> (32 - r)))
-    union {const nk_uint *i; const nk_byte *b;} conv = {0};
     const nk_byte *data = (const nk_byte*)key;
     const int nblocks = len/4;
     nk_uint h1 = seed;
     const nk_uint c1 = 0xcc9e2d51;
     const nk_uint c2 = 0x1b873593;
     const nk_byte *tail;
+#if defined(X86_32) || defined(X86_64)
     const nk_uint *blocks;
+#else
+	const nk_byte *blocks;
+#endif
     nk_uint k1;
     int i;
 
     /* body */
     if (!key) return 0;
-    conv.b = (data + nblocks*4);
-    blocks = (const nk_uint*)conv.i;
-    for (i = -nblocks; i; ++i) {
-        k1 = blocks[i];
+#if defined(X86_32) || defined(X86_64)
+    blocks = (const nk_uint*)(data + nblocks*4);
+	for (i = -nblocks; i; ++i) {
+		k1 = blocks[i];
+#else
+	blocks = data + nblocks*4;
+	for (i = -4 * nblocks; i; ++i) {
+		k1 = blocks[i++] << 24;
+		k1 |= blocks[i++] << 16;
+		k1 |= blocks[i++] << 8;
+		k1 |= blocks[i] << 16;
+#endif
+        
         k1 *= c1;
         k1 = NK_ROTL(k1,15);
         k1 *= c2;