Skip to content

Commit

Permalink
Move fnv1() to ethash.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Nov 9, 2021
1 parent 10f0c63 commit f9c5fba
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 34 deletions.
1 change: 0 additions & 1 deletion lib/ethash/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ set_target_properties(ethash PROPERTIES C_EXTENSIONS OFF CXX_EXTENSIONS OFF)
target_link_libraries(ethash PRIVATE ethash::keccak)
target_include_directories(ethash PUBLIC $<BUILD_INTERFACE:${include_dir}>$<INSTALL_INTERFACE:include>)
target_sources(ethash PRIVATE
bit_manipulation.h
builtins.h
endianness.hpp
${include_dir}/ethash/ethash.h
Expand Down
31 changes: 0 additions & 31 deletions lib/ethash/bit_manipulation.h

This file was deleted.

11 changes: 9 additions & 2 deletions lib/ethash/ethash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include "ethash-internal.hpp"

#include "bit_manipulation.h"
#include "primes.h"
#include <ethash/keccak.hpp>
#include <cstdlib>
Expand All @@ -29,7 +28,15 @@ static_assert(full_dataset_item_size == ETHASH_FULL_DATASET_ITEM_SIZE, "");

namespace
{
using ::fnv1;
/// The core transformation of the FNV-1 hash function.
/// https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function#FNV-1_hash.
NO_SANITIZE("unsigned-integer-overflow")
inline uint32_t fnv1(uint32_t u, uint32_t v) noexcept
{
static const uint32_t fnv_prime = 0x01000193;
return (u * fnv_prime) ^ v;
}


inline hash512 fnv1(const hash512& u, const hash512& v) noexcept
{
Expand Down

0 comments on commit f9c5fba

Please sign in to comment.