Fumofumotris/source/game/hash.c

23 lines
366 B
C
Raw Normal View History

2024-04-10 20:05:56 +00:00
#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;
}