summaryrefslogtreecommitdiffhomepage
path: root/dev/libSystem/src/Utils.cc
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-11-15 06:07:15 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2025-11-15 06:07:15 +0100
commitb2c4d9a8ebebf87be33dcc357af86102d31dac47 (patch)
treed92f48fa8c936b849de60ad3cad61a75ad1983df /dev/libSystem/src/Utils.cc
parent41d29ecc10da26c9e03095376569216a43550be5 (diff)
feat: DDK: compiler improvements and working on fwrk standard and launch
design. Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/libSystem/src/Utils.cc')
-rw-r--r--dev/libSystem/src/Utils.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/dev/libSystem/src/Utils.cc b/dev/libSystem/src/Utils.cc
new file mode 100644
index 00000000..0688cd57
--- /dev/null
+++ b/dev/libSystem/src/Utils.cc
@@ -0,0 +1,29 @@
+/* -------------------------------------------
+
+ Copyright (C) 2025, Amlal El Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+#include <libSystem/SystemKit/Err.h>
+#include <libSystem/SystemKit/Syscall.h>
+#include <libSystem/SystemKit/System.h>
+#include <libSystem/SystemKit/Verify.h>
+
+using namespace LibSystem;
+
+/// @note This uses the FNV 64-bit variant.
+IMPORT_C UInt64 libsys_hash_64(const Char* path) {
+ if (!path || *path == 0) return 0;
+
+ const UInt64 kFNVSeed = 0xcbf29ce484222325ULL;
+ const UInt64 kFNVPrime = 0x100000001b3ULL;
+
+ UInt64 hash = kFNVSeed;
+
+ while (*path) {
+ hash ^= (Char) (*path++);
+ hash *= kFNVPrime;
+ }
+
+ return hash;
+}