diff --git a/benchmark/average.cpp b/benchmark/average.cpp index 83152cf..d1e8d57 100644 --- a/benchmark/average.cpp +++ b/benchmark/average.cpp @@ -5,10 +5,8 @@ #include #include #include -#include #include #include -#include #include #include #include @@ -57,11 +55,8 @@ template void test( int N ) test_( N ); test_( N ); - test_( N ); - test_( N ); test_( N ); test_( N ); - test_( N ); test_( N ); test_( N ); test_( N ); diff --git a/benchmark/buffer.cpp b/benchmark/buffer.cpp index 13fdb4a..bf987e6 100644 --- a/benchmark/buffer.cpp +++ b/benchmark/buffer.cpp @@ -5,8 +5,6 @@ #include #include #include -#include -#include #include #include #include @@ -46,11 +44,8 @@ void test( int N, int M ) { test_( data, N, M ); test_( data, N, M ); - test_( data, N, M ); - test_( data, N, M ); test_( data, N, M ); test_( data, N, M ); - test_( data, N, M ); test_( data, N, M ); test_( data, N, M ); test_( data, N, M ); diff --git a/benchmark/keys.cpp b/benchmark/keys.cpp index 23cf979..4f6c121 100644 --- a/benchmark/keys.cpp +++ b/benchmark/keys.cpp @@ -7,10 +7,8 @@ #include #include #include -#include #include #include -#include #include #include #include @@ -25,132 +23,6 @@ #define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) -class mul31_32 -{ -private: - - std::uint32_t st_; - -public: - - typedef std::uint32_t result_type; - typedef std::uint32_t size_type; - - mul31_32(): st_( 0x811C9DC5ul ) - { - } - - explicit mul31_32( std::uint64_t seed ): st_( 0x811C9DC5ul ^ ( seed & 0xFFFFFFFFu ) ^ ( seed >> 32 ) ) - { - } - - void update( void const * pv, std::size_t n ) - { - unsigned char const* p = static_cast( pv ); - - std::uint32_t h = st_; - -#if 0 - - for( std::size_t i = 0; i < n; ++i ) - { - h = h * 31 + static_cast( p[i] ); - } - -#else - - while( n >= 4 ) - { - h = h * (31u * 31u * 31u * 31u) + p[0] * (31u * 31u * 31u) + p[1] * (31u * 31u) + p[2] * 31u + p[3]; - - p += 4; - n -= 4; - } - - while( n > 0 ) - { - h = h * 31u + *p; - - ++p; - --n; - } - -#endif - - st_ = h; - } - - std::uint32_t result() - { - std::uint32_t r = st_; - st_ = st_ * 31 + 0xFF; - return r; - } -}; - -class mul31_64 -{ -private: - - std::uint64_t st_; - -public: - - typedef std::uint64_t result_type; - typedef std::uint64_t size_type; - - mul31_64(): st_( 0xCBF29CE484222325ull ) - { - } - - explicit mul31_64( std::uint64_t seed ): st_( 0xCBF29CE484222325ull ^ seed ) - { - } - - void update( void const * pv, std::size_t n ) - { - unsigned char const* p = static_cast( pv ); - - std::uint64_t h = st_; - -#if 0 - - for( std::size_t i = 0; i < n; ++i ) - { - h = h * 31 + static_cast( p[i] ); - } - -#else - - while( n >= 4 ) - { - h = h * (31u * 31u * 31u * 31u) + p[0] * (31u * 31u * 31u) + p[1] * (31u * 31u) + p[2] * 31u + p[3]; - - p += 4; - n -= 4; - } - - while( n > 0 ) - { - h = h * 31u + *p; - - ++p; - --n; - } - -#endif - - st_ = h; - } - - std::uint64_t result() - { - std::uint64_t r = st_; - st_ = st_ * 31 + 0xFF; - return r; - } -}; - template class hasher { private: @@ -252,15 +124,10 @@ int main() } } - test2( N, v ); - test2( N, v ); test2( N, v ); test2( N, v ); - test2( N, v ); - test2( N, v ); test2( N, v ); test2( N, v ); - test2( N, v ); test2( N, v ); test2( N, v ); diff --git a/benchmark/unordered.cpp b/benchmark/unordered.cpp index 3892016..8a0cf9b 100644 --- a/benchmark/unordered.cpp +++ b/benchmark/unordered.cpp @@ -7,10 +7,8 @@ #include #include #include -#include #include #include -#include #include #include #include @@ -26,132 +24,6 @@ #define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) -class mul31_32 -{ -private: - - std::uint32_t st_; - -public: - - typedef std::uint32_t result_type; - typedef std::uint32_t size_type; - - mul31_32(): st_( 0x811C9DC5ul ) - { - } - - explicit mul31_32( std::uint64_t seed ): st_( 0x811C9DC5ul ^ ( seed & 0xFFFFFFFFu ) ^ ( seed >> 32 ) ) - { - } - - void update( void const * pv, std::size_t n ) - { - unsigned char const* p = static_cast( pv ); - - std::uint32_t h = st_; - -#if 0 - - for( std::size_t i = 0; i < n; ++i ) - { - h = h * 31 + static_cast( p[i] ); - } - -#else - - while( n >= 4 ) - { - h = h * (31u * 31u * 31u * 31u) + p[0] * (31u * 31u * 31u) + p[1] * (31u * 31u) + p[2] * 31u + p[3]; - - p += 4; - n -= 4; - } - - while( n > 0 ) - { - h = h * 31u + *p; - - ++p; - --n; - } - -#endif - - st_ = h; - } - - std::uint32_t result() - { - std::uint32_t r = st_; - st_ = st_ * 31 + 0xFF; - return r; - } -}; - -class mul31_64 -{ -private: - - std::uint64_t st_; - -public: - - typedef std::uint64_t result_type; - typedef std::uint64_t size_type; - - mul31_64(): st_( 0xCBF29CE484222325ull ) - { - } - - explicit mul31_64( std::uint64_t seed ): st_( 0xCBF29CE484222325ull ^ seed ) - { - } - - void update( void const * pv, std::size_t n ) - { - unsigned char const* p = static_cast( pv ); - - std::uint64_t h = st_; - -#if 0 - - for( std::size_t i = 0; i < n; ++i ) - { - h = h * 31 + static_cast( p[i] ); - } - -#else - - while( n >= 4 ) - { - h = h * (31u * 31u * 31u * 31u) + p[0] * (31u * 31u * 31u) + p[1] * (31u * 31u) + p[2] * 31u + p[3]; - - p += 4; - n -= 4; - } - - while( n > 0 ) - { - h = h * 31u + *p; - - ++p; - --n; - } - -#endif - - st_ = h; - } - - std::uint64_t result() - { - std::uint64_t r = st_; - st_ = st_ * 31 + 0xFF; - return r; - } -}; - template class hasher { private: @@ -274,15 +146,10 @@ int main() std::puts( "" ); } - test2( N, v ); - test2( N, v ); test2( N, v ); test2( N, v ); - test2( N, v ); - test2( N, v ); test2( N, v ); test2( N, v ); - test2( N, v ); test2( N, v ); test2( N, v ); test2( N, v ); diff --git a/include/boost/hash2/murmur3.hpp b/include/boost/hash2/legacy/murmur3.hpp similarity index 100% rename from include/boost/hash2/murmur3.hpp rename to include/boost/hash2/legacy/murmur3.hpp diff --git a/include/boost/hash2/spooky2.hpp b/include/boost/hash2/legacy/spooky2.hpp similarity index 100% rename from include/boost/hash2/spooky2.hpp rename to include/boost/hash2/legacy/spooky2.hpp diff --git a/test/Jamfile b/test/Jamfile index 7400613..7789dd8 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -46,9 +46,6 @@ run fnv1a.cpp ; run siphash32.cpp ; run siphash64.cpp ; run xxhash.cpp ; -run spooky2.cpp ; -run murmur3_32.cpp ; -run murmur3_128.cpp ; # cryptographic @@ -57,6 +54,12 @@ run hmac_md5.cpp ; run sha1.cpp ; run hmac_sha1.cpp ; +# legacy + +run legacy/spooky2.cpp ; +run legacy/murmur3_32.cpp ; +run legacy/murmur3_128.cpp ; + # general requirements run concept.cpp ; diff --git a/test/concept.cpp b/test/concept.cpp index cc15517..072afad 100644 --- a/test/concept.cpp +++ b/test/concept.cpp @@ -5,8 +5,6 @@ #include #include #include -#include -#include #include #include #include @@ -345,11 +343,8 @@ int main() { test(); test(); - test(); - test(); test(); test(); - test(); test(); test(); test(); diff --git a/test/integral_result.cpp b/test/integral_result.cpp index 402009c..aa0c1fc 100644 --- a/test/integral_result.cpp +++ b/test/integral_result.cpp @@ -5,8 +5,6 @@ #include #include #include -#include -#include #include #include #include @@ -30,11 +28,8 @@ int main() { test(); test(); - test(); - test(); test(); test(); - test(); test(); test(); test(); diff --git a/test/murmur3_128.cpp b/test/legacy/murmur3_128.cpp similarity index 97% rename from test/murmur3_128.cpp rename to test/legacy/murmur3_128.cpp index 0b60780..0d43f6a 100644 --- a/test/murmur3_128.cpp +++ b/test/legacy/murmur3_128.cpp @@ -4,7 +4,7 @@ #define _CRT_SECURE_NO_WARNINGS -#include +#include #include #include #include diff --git a/test/murmur3_32.cpp b/test/legacy/murmur3_32.cpp similarity index 97% rename from test/murmur3_32.cpp rename to test/legacy/murmur3_32.cpp index 55ea0e4..67e5820 100644 --- a/test/murmur3_32.cpp +++ b/test/legacy/murmur3_32.cpp @@ -2,7 +2,7 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include +#include #include #include #include diff --git a/test/spooky2.cpp b/test/legacy/spooky2.cpp similarity index 99% rename from test/spooky2.cpp rename to test/legacy/spooky2.cpp index 5f8db31..2866c5c 100644 --- a/test/spooky2.cpp +++ b/test/legacy/spooky2.cpp @@ -2,7 +2,7 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#include +#include #include #include #include diff --git a/test/multiple_result.cpp b/test/multiple_result.cpp index f6cff24..29921bc 100644 --- a/test/multiple_result.cpp +++ b/test/multiple_result.cpp @@ -5,8 +5,6 @@ #include #include #include -#include -#include #include #include #include @@ -33,11 +31,8 @@ int main() { test(); test(); - test(); - test(); test(); test(); - test(); test(); test(); test(); diff --git a/test/plaintext_leak.cpp b/test/plaintext_leak.cpp index f3b4c56..ceea31a 100644 --- a/test/plaintext_leak.cpp +++ b/test/plaintext_leak.cpp @@ -5,8 +5,6 @@ #include #include #include -#include -#include #include #include #include @@ -51,11 +49,8 @@ int main() { test(); test(); - test(); - test(); test(); test(); - test(); test(); test(); test();