Mercurial > repos > blastem
comparison 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 |
comparison
equal
deleted
inserted
replaced
1842:49f65d240299 | 1843:13abdc98379e |
---|---|
5555 NK_API nk_hash | 5555 NK_API nk_hash |
5556 nk_murmur_hash(const void * key, int len, nk_hash seed) | 5556 nk_murmur_hash(const void * key, int len, nk_hash seed) |
5557 { | 5557 { |
5558 /* 32-Bit MurmurHash3: https://code.google.com/p/smhasher/wiki/MurmurHash3*/ | 5558 /* 32-Bit MurmurHash3: https://code.google.com/p/smhasher/wiki/MurmurHash3*/ |
5559 #define NK_ROTL(x,r) ((x) << (r) | ((x) >> (32 - r))) | 5559 #define NK_ROTL(x,r) ((x) << (r) | ((x) >> (32 - r))) |
5560 union {const nk_uint *i; const nk_byte *b;} conv = {0}; | |
5561 const nk_byte *data = (const nk_byte*)key; | 5560 const nk_byte *data = (const nk_byte*)key; |
5562 const int nblocks = len/4; | 5561 const int nblocks = len/4; |
5563 nk_uint h1 = seed; | 5562 nk_uint h1 = seed; |
5564 const nk_uint c1 = 0xcc9e2d51; | 5563 const nk_uint c1 = 0xcc9e2d51; |
5565 const nk_uint c2 = 0x1b873593; | 5564 const nk_uint c2 = 0x1b873593; |
5566 const nk_byte *tail; | 5565 const nk_byte *tail; |
5566 #if defined(X86_32) || defined(X86_64) | |
5567 const nk_uint *blocks; | 5567 const nk_uint *blocks; |
5568 #else | |
5569 const nk_byte *blocks; | |
5570 #endif | |
5568 nk_uint k1; | 5571 nk_uint k1; |
5569 int i; | 5572 int i; |
5570 | 5573 |
5571 /* body */ | 5574 /* body */ |
5572 if (!key) return 0; | 5575 if (!key) return 0; |
5573 conv.b = (data + nblocks*4); | 5576 #if defined(X86_32) || defined(X86_64) |
5574 blocks = (const nk_uint*)conv.i; | 5577 blocks = (const nk_uint*)(data + nblocks*4); |
5575 for (i = -nblocks; i; ++i) { | 5578 for (i = -nblocks; i; ++i) { |
5576 k1 = blocks[i]; | 5579 k1 = blocks[i]; |
5580 #else | |
5581 blocks = data + nblocks*4; | |
5582 for (i = -4 * nblocks; i; ++i) { | |
5583 k1 = blocks[i++] << 24; | |
5584 k1 |= blocks[i++] << 16; | |
5585 k1 |= blocks[i++] << 8; | |
5586 k1 |= blocks[i] << 16; | |
5587 #endif | |
5588 | |
5577 k1 *= c1; | 5589 k1 *= c1; |
5578 k1 = NK_ROTL(k1,15); | 5590 k1 = NK_ROTL(k1,15); |
5579 k1 *= c2; | 5591 k1 *= c2; |
5580 | 5592 |
5581 h1 ^= k1; | 5593 h1 ^= k1; |