Voxia OS
v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
hash.c
Go to the documentation of this file.
1
#include <
hash.h
>
2
3
uint64_t
hash
(
const
char
*
str
,
size_t
max_size) {
4
uint64_t
h
= 0xcbf29ce484222325ULL;
5
6
const
char
* p =
str
;
7
while
(*p) {
8
h
^= (
uint64_t
) (
unsigned
char
) *p++;
9
h
*= 0x9e3779b97f4a7c15ULL;
10
}
11
h
^=
h
>> 32;
12
13
return
max_size ? (
h
% max_size) :
h
;
14
}
15
16
uint32_t
hash32
(
const
char
*
str
,
size_t
max_size) {
17
uint32_t
h
= 0xcbf29ce4ULL;
18
19
const
char
* p =
str
;
20
while
(*p) {
21
h
^= (
uint32_t
) (
unsigned
char
) *p++;
22
h
*= 0x9e3779bULL;
23
}
24
25
return
max_size ? (
h
% max_size) :
h
;
26
}
h
struct SDT h
Definition
acpi.h:0
hash
uint32_t hash
Definition
dentry.h:3
hash32
uint32_t hash32(const char *str, size_t max_size)
Definition
hash.c:16
hash.h
str
kstring str(const char *str)
uint32_t
unsigned int uint32_t
Definition
type.h:19
uint64_t
unsigned long uint64_t
Definition
type.h:25
kernel
libk
hash.c
Generated on Sat May 30 2026 11:09:57 for Voxia OS by
1.13.2