cleanup fnv1a impl

This commit is contained in:
BlackMATov
2023-12-29 19:50:28 +07:00
parent fe2c1045e2
commit f248035c30
3 changed files with 6 additions and 8 deletions

View File

@@ -10,7 +10,6 @@
#include <array>
#include <atomic>
#include <cassert>
#include <climits>
#include <compare>
#include <cstddef>
#include <cstdint>
@@ -731,18 +730,18 @@ namespace meta_hpp::detail
// REFERENCE:
// https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
template < std::size_t SizeBits = CHAR_BIT * sizeof(std::size_t) >
template < std::size_t SizeBytes = sizeof(std::size_t) >
struct fnv1a_hash_traits;
template <>
struct fnv1a_hash_traits<32> { // NOLINT(*-magic-numbers)
struct fnv1a_hash_traits<sizeof(std::uint32_t)> {
using underlying_type = std::uint32_t;
static inline constexpr underlying_type prime{16777619U};
static inline constexpr underlying_type offset_basis{2166136261U};
};
template <>
struct fnv1a_hash_traits<64> { // NOLINT(*-magic-numbers)
struct fnv1a_hash_traits<sizeof(std::uint64_t)> {
using underlying_type = std::uint64_t;
static inline constexpr underlying_type prime{1099511628211U};
static inline constexpr underlying_type offset_basis{14695981039346656037U};

View File

@@ -7,7 +7,6 @@
#pragma once
#include <cassert>
#include <climits>
#include <cstddef>
#include <cstdint>
#include <cstdlib>

View File

@@ -13,18 +13,18 @@ namespace meta_hpp::detail
// REFERENCE:
// https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
template < std::size_t SizeBits = CHAR_BIT * sizeof(std::size_t) >
template < std::size_t SizeBytes = sizeof(std::size_t) >
struct fnv1a_hash_traits;
template <>
struct fnv1a_hash_traits<32> { // NOLINT(*-magic-numbers)
struct fnv1a_hash_traits<sizeof(std::uint32_t)> {
using underlying_type = std::uint32_t;
static inline constexpr underlying_type prime{16777619U};
static inline constexpr underlying_type offset_basis{2166136261U};
};
template <>
struct fnv1a_hash_traits<64> { // NOLINT(*-magic-numbers)
struct fnv1a_hash_traits<sizeof(std::uint64_t)> {
using underlying_type = std::uint64_t;
static inline constexpr underlying_type prime{1099511628211U};
static inline constexpr underlying_type offset_basis{14695981039346656037U};