mirror of
https://github.com/BlackMATov/meta.hpp.git
synced 2025-12-13 19:18:01 +07:00
cleanup fnv1a impl
This commit is contained in:
@@ -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};
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <cassert>
|
||||
#include <climits>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -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};
|
||||
|
||||
Reference in New Issue
Block a user