23 lines
366 B
C
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;
|
||
|
}
|