mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Toy now fits into the C spec. Fixed #158 Addendum: MacOS test caught an error: error: a function declaration without a prototype is deprecated in all versions of C That took 3 attempts to fix correctly. Addendum: 'No new line at the end of file' are you shitting me?
20 lines
447 B
C
20 lines
447 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(void) {
|
|
//print the index/hash pairs
|
|
for (unsigned int i = 0; i < 100; i++) {
|
|
unsigned int h = hashUInt(i);
|
|
printf("%u: %u %% 8 = %u\n", i, h, h % 8);
|
|
}
|
|
|
|
return 0;
|
|
}
|