summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2026-01-21 22:42:25 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2026-01-21 22:42:25 +0100
commit28dd60c619aaa9c5e4100779f60e6e11864900cb (patch)
tree07a97a0f42b82af4c33dbf06d8c90b3e456fcf24 /include
parent8f0afe0818c275cacc5960193027f6a3929e0a60 (diff)
feat: add wchar_t operator for crc-hash.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/ocl/crc_hash.hpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/include/ocl/crc_hash.hpp b/include/ocl/crc_hash.hpp
index 8775e79..412ec63 100644
--- a/include/ocl/crc_hash.hpp
+++ b/include/ocl/crc_hash.hpp
@@ -56,13 +56,13 @@ namespace ocl
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d};
- template <typename algorithm>
- static constexpr algorithm crc(const char* in, std::size_t len)
+ template <typename Algorithm, typename Ch = char>
+ static constexpr Algorithm crc(const Ch* in, std::size_t len)
{
if (!len)
return 0UL;
- algorithm crc = 0xffffffff;
+ Algorithm crc = 0xffffffff;
std::size_t cnt = 0;
while ((len--) > 0)
@@ -95,6 +95,12 @@ operator""_crc32(const char* in, std::size_t len) noexcept
return ocl::crc_hash_trait::crc<std::uint32_t>(static_cast<const char*>(in), len);
}
+inline std::uint32_t
+operator""_crc32(const wchar_t* in, std::size_t len) noexcept
+{
+ return ocl::crc_hash_trait::crc<std::uint32_t, wchar_t>(static_cast<const wchar_t*>(in), len);
+}
+
namespace std
{
template <>