dice-hash
Hash function for stl types and container
Loading...
Searching...
No Matches
MathEngine.hpp
1#ifndef DICE_HASH_MATHENGINE_HPP
2#define DICE_HASH_MATHENGINE_HPP
3
4#include "dice/hash/lthash/MathEngine_Hwy.hpp"
5#include "dice/hash/lthash/MathEngine_Simple.hpp"
6
7namespace dice::hash::lthash {
8 template<typename B>
9 concept UnpaddedBits = requires {
10 { B::bits_per_element } -> std::convertible_to<size_t>;
11 };
12
13 template<typename B>
14 concept PaddedBits = requires {
15 requires UnpaddedBits<B>;
16 { B::needs_padding } -> std::convertible_to<std::true_type>;
17 { B::data_mask } -> std::convertible_to<uint64_t>;
18 };
19
20 template<template<typename> typename ME, typename B>
21 concept UnpaddedMathEngine = requires (std::span<std::byte> dst, std::span<std::byte const> src) {
22 requires UnpaddedBits<B>;
23 { ME<B>::min_buffer_align } -> std::convertible_to<size_t>;
24 ME<B>::add(dst, src);
25 ME<B>::sub(dst, src);
26 };
27
28 template<template<typename> typename ME, typename B>
29 concept PaddedMathEngine = requires (std::span<std::byte const> data, std::span<std::byte> out) {
30 requires PaddedBits<B>;
31 { ME<B>::check_padding_bits(data) } -> std::convertible_to<bool>;
32 ME<B>::clear_padding_bits(out);
33 };
34
35 template<template<typename> typename ME, typename B>
37
38 template<typename Bits>
39 using DefaultMathEngine = MathEngine_Hwy<Bits>;
40} // namespace dice::hash::lthash
41
42#endif//DICE_HASH_MATHENGINE_HPP
Definition MathEngine.hpp:36
Definition MathEngine.hpp:14
Definition MathEngine.hpp:29
Definition MathEngine.hpp:9
Definition MathEngine.hpp:21