From a92e458baaf24f0a8856c556cf83b9b52febfa7f Mon Sep 17 00:00:00 2001 From: BossZou Date: Mon, 31 Mar 2025 21:28:34 +0800 Subject: [PATCH 1/4] Add types --- include/builtin/types.h | 11 +++++++++++ include/hash/types.h | 9 +++++++++ include/jaclks/hash/hasher.h | 7 ++++--- 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 include/builtin/types.h create mode 100644 include/hash/types.h diff --git a/include/builtin/types.h b/include/builtin/types.h new file mode 100644 index 0000000..523d7f7 --- /dev/null +++ b/include/builtin/types.h @@ -0,0 +1,11 @@ +#pragma once + +#include + +namespace jaclks { + +typedef std::size_t Size_t; + +typedef std::uint32_t UInt32_t; + +} diff --git a/include/hash/types.h b/include/hash/types.h new file mode 100644 index 0000000..ecd3bfd --- /dev/null +++ b/include/hash/types.h @@ -0,0 +1,9 @@ +#pragma once + +#include "builtin/types.h" + +namespace jaclks { + +typedef Size_t Hash_t; + +} \ No newline at end of file diff --git a/include/jaclks/hash/hasher.h b/include/jaclks/hash/hasher.h index be5dc8e..a5fbcb2 100644 --- a/include/jaclks/hash/hasher.h +++ b/include/jaclks/hash/hasher.h @@ -4,19 +4,20 @@ #include #include "jaclks/compile/type_traits.h" +#include "hash/types.h" namespace jaclks { template struct Hasher { - std::size_t operator()(const T &x) const noexcept { + Hash_t operator()(const T &x) const noexcept { return std::hash{}(x); } }; template struct Hasher { - std::size_t operator()(const T *x) const noexcept { + Hash_t operator()(const T *x) const noexcept { if (x == nullptr) { return 0; } @@ -28,7 +29,7 @@ template struct Hasher>> { using Type = std::decay_t; - std::size_t operator()(const T &x) const noexcept { + Hash_t operator()(const T &x) const noexcept { if (x == nullptr) { return 0; } From 4105747939396e3cc72234b14101b5f00c10b598 Mon Sep 17 00:00:00 2001 From: BossZou Date: Mon, 31 Mar 2025 21:32:03 +0800 Subject: [PATCH 2/4] Format --- include/builtin/types.h | 2 +- include/hash/types.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/builtin/types.h b/include/builtin/types.h index 523d7f7..1bdd649 100644 --- a/include/builtin/types.h +++ b/include/builtin/types.h @@ -8,4 +8,4 @@ typedef std::size_t Size_t; typedef std::uint32_t UInt32_t; -} +} // namespace jaclks diff --git a/include/hash/types.h b/include/hash/types.h index ecd3bfd..acd2878 100644 --- a/include/hash/types.h +++ b/include/hash/types.h @@ -6,4 +6,4 @@ namespace jaclks { typedef Size_t Hash_t; -} \ No newline at end of file +} // namespace jaclks From adf7e7cff2665eca7521c0bdb368ab70ceefd443 Mon Sep 17 00:00:00 2001 From: BossZou Date: Sun, 24 Aug 2025 22:50:00 +0800 Subject: [PATCH 3/4] Fix --- include/jaclks/hash/hasher.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/jaclks/hash/hasher.h b/include/jaclks/hash/hasher.h index a5fbcb2..26a18d6 100644 --- a/include/jaclks/hash/hasher.h +++ b/include/jaclks/hash/hasher.h @@ -4,7 +4,7 @@ #include #include "jaclks/compile/type_traits.h" -#include "hash/types.h" +#include "jaclks/hash/types.h" namespace jaclks { From c29f4ef38008248051be1c3b7cfef44e0c604e67 Mon Sep 17 00:00:00 2001 From: BossZou Date: Sun, 24 Aug 2025 22:59:23 +0800 Subject: [PATCH 4/4] Fix --- include/hash/types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hash/types.h b/include/hash/types.h index acd2878..8f03bf6 100644 --- a/include/hash/types.h +++ b/include/hash/types.h @@ -1,6 +1,6 @@ #pragma once -#include "builtin/types.h" +#include "jaclks/builtin/types.h" namespace jaclks {