Attempted to separate the snippets of code to small functions and each set of functions have its own file. Also made some improvements by using pools instead of constantly mallocing space.

This commit is contained in:
metallaxis committed 2026-05-07 02:00:15 +03:00
1 parent 00396f86fe
commit e3239bf564
15 files changed
+561 -289

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
#include "hash.h"
unsigned int hash_three128(uint128_t a, uint128_t b, uint128_t c) {
uint128_t x = a + (uint128_t)0x9e3779b97f4a7c15ULL + ((uint128_t)0x9e3779b97f4a7c15ULL << 64);
x ^= b + ((uint128_t)0xbf58476d1ce4e5b9ULL + ((uint128_t)0xbf58476d1ce4e5b9ULL << 64)) + (x << 6) + (x >> 2);
x ^= c + ((uint128_t)0x94d049bb133111ebULL + ((uint128_t)0x94d049bb133111ebULL << 64)) + (x << 6) + (x >> 2);
return (unsigned int)(x % HASH_SIZE);
}
void sort_triplet(int128_t* a, int128_t* b, int128_t* c) {
int128_t tmp;
if (*a > *b) { tmp = *a; *a = *b; *b = tmp; }
if (*b > *c) { tmp = *b; *b = *c; *c = tmp; }
if (*a > *b) { tmp = *a; *a = *b; *b = tmp; }
}