move files

This commit is contained in:
2026-08-14 01:53:25 +03:00
parent 2b30d26a56
commit 7188ac6b4a
32 changed files with 0 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
#include "hash.h"
#include <stddef.h>
#define JOAAT_SEED 0x9e3779b9u
uint32_t joaat_hash_bytes(const void *data, size_t len)
{
uint32_t hash = JOAAT_SEED;
const unsigned char *p = (const unsigned char *)data;
while (len-- > 0) {
hash += *p++;
hash += (hash << 10);
hash ^= (hash >> 6);
}
hash += (hash << 3);
hash ^= (hash >> 11);
hash += (hash << 15);
return hash;
}
uint32_t joaat_hash(const char *str)
{
uint32_t hash = JOAAT_SEED;
const unsigned char *p = (const unsigned char *)str;
while (*p) {
hash += *p++;
hash += (hash << 10);
hash ^= (hash >> 6);
}
hash += (hash << 3);
hash ^= (hash >> 11);
hash += (hash << 15);
return hash;
}
unsigned int hash(const char *str)
{
return (unsigned int)joaat_hash(str);
}
+21
View File
@@ -0,0 +1,21 @@
#ifndef ARSV_JOAAT_HASH_H
#define ARSV_JOAAT_HASH_H
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
uint32_t joaat_hash(const char *str);
uint32_t joaat_hash_bytes(const void *data, size_t len);
/* Compatibility wrapper matching the original set.c function name. */
unsigned int hash(const char *str);
#ifdef __cplusplus
}
#endif
#endif /* ARSV_JOAAT_HASH_H */