mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
18 lines
401 B
C
18 lines
401 B
C
https://www.programiz.com/c-programming/online-compiler/
|
|
#include <stdio.h>
|
|
|
|
static unsigned int hashUInt(unsigned int x) {
|
|
x = ((x >> 16) ^ x) * 0x45d9f3b;
|
|
x = ((x >> 16) ^ x) * 0x45d9f3b;
|
|
x = (x >> 16) ^ x;
|
|
return x;
|
|
}
|
|
|
|
int main() {
|
|
//print the index/hash pairs
|
|
for (unsigned int i = 0; i < 100; i++) {
|
|
printf("{%u:%u}\n", i, hashUInt(i) % 16);
|
|
}
|
|
|
|
return 0;
|
|
} |