Fumofumotris/source/misc/hash.c
Julia e856594741 hi
uikhj
2024-04-16 17:14:53 -05:00

23 lines
366 B
C

#include <iso646.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include "fumotris.h"
typedef u32 hashtype;
hashtype Hash(void *item, size_t size)
{
u8 *data = (u8 *)item;
u32 h = 98317;
for (size_t i = 0; i < size; i++) {
h ^= data[i];
h *= 0x5bd1e995;
h ^= h >> 15;
}
return h;
}