aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/hash_primes.cpp
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:17 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:17 +0300
commitd3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch)
treedd4bd3ca0f36b817e96812825ffaf10d645803f2 /util/generic/hash_primes.cpp
parent72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff)
downloadydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'util/generic/hash_primes.cpp')
-rw-r--r--util/generic/hash_primes.cpp56
1 files changed, 28 insertions, 28 deletions
diff --git a/util/generic/hash_primes.cpp b/util/generic/hash_primes.cpp
index 6ea00b3918..656d31e046 100644
--- a/util/generic/hash_primes.cpp
+++ b/util/generic/hash_primes.cpp
@@ -1,21 +1,21 @@
#include "hash_primes.h"
#include "array_size.h"
-#include "algorithm.h"
+#include "algorithm.h"
/// Order of fields: reciprocal, reciprocal shift, adjacent hint, divisor
#if defined(_32_)
static constexpr ::NPrivate::THashDivisor PRIME_DIVISORS_HOLDER[]{
- {0x00000000u, 0u, -1, 0xffffffffu}, // guard value, not a valid divisor
- {0x24924925u, 2u, 0, 7u},
- {0xe1e1e1e2u, 4u, 1, 17u},
- {0x1a7b9612u, 4u, 2, 29u},
- {0x3521cfb3u, 5u, 3, 53u},
- {0x51d07eafu, 6u, 4, 97u},
- {0x53909490u, 7u, 5, 193u},
- {0x50f22e12u, 8u, 6, 389u},
- {0x54e3b41au, 9u, 7, 769u},
- {0x53c8eaeeu, 10u, 8, 1543u},
- {0x548eacc6u, 11u, 9, 3079u},
+ {0x00000000u, 0u, -1, 0xffffffffu}, // guard value, not a valid divisor
+ {0x24924925u, 2u, 0, 7u},
+ {0xe1e1e1e2u, 4u, 1, 17u},
+ {0x1a7b9612u, 4u, 2, 29u},
+ {0x3521cfb3u, 5u, 3, 53u},
+ {0x51d07eafu, 6u, 4, 97u},
+ {0x53909490u, 7u, 5, 193u},
+ {0x50f22e12u, 8u, 6, 389u},
+ {0x54e3b41au, 9u, 7, 769u},
+ {0x53c8eaeeu, 10u, 8, 1543u},
+ {0x548eacc6u, 11u, 9, 3079u},
{0x54f1e41eu, 12u, 10, 6151u},
{0x554e390au, 13u, 11, 12289u},
{0x5518ee41u, 14u, 12, 24593u},
@@ -40,17 +40,17 @@ static constexpr ::NPrivate::THashDivisor PRIME_DIVISORS_HOLDER[]{
};
#else
static constexpr ::NPrivate::THashDivisor PRIME_DIVISORS_HOLDER[]{
- {0x0000000000000000ul, 0u, -1, 0xffffffffu}, // guard value, not a valid divisor
- {0x2492492492492493ul, 2u, 0, 7u},
- {0xe1e1e1e1e1e1e1e2ul, 4u, 1, 17u},
- {0x1a7b9611a7b9611bul, 4u, 2, 29u},
- {0x3521cfb2b78c1353ul, 5u, 3, 53u},
- {0x51d07eae2f8151d1ul, 6u, 4, 97u},
- {0x5390948f40feac70ul, 7u, 5, 193u},
- {0x50f22e111c4c56dful, 8u, 6, 389u},
- {0x54e3b4194ce65de1ul, 9u, 7, 769u},
- {0x53c8eaedea6e7f17ul, 10u, 8, 1543u},
- {0x548eacc5e1e6e3fcul, 11u, 9, 3079u},
+ {0x0000000000000000ul, 0u, -1, 0xffffffffu}, // guard value, not a valid divisor
+ {0x2492492492492493ul, 2u, 0, 7u},
+ {0xe1e1e1e1e1e1e1e2ul, 4u, 1, 17u},
+ {0x1a7b9611a7b9611bul, 4u, 2, 29u},
+ {0x3521cfb2b78c1353ul, 5u, 3, 53u},
+ {0x51d07eae2f8151d1ul, 6u, 4, 97u},
+ {0x5390948f40feac70ul, 7u, 5, 193u},
+ {0x50f22e111c4c56dful, 8u, 6, 389u},
+ {0x54e3b4194ce65de1ul, 9u, 7, 769u},
+ {0x53c8eaedea6e7f17ul, 10u, 8, 1543u},
+ {0x548eacc5e1e6e3fcul, 11u, 9, 3079u},
{0x54f1e41d7767d70cul, 12u, 10, 6151u},
{0x554e39097a781d80ul, 13u, 11, 12289u},
{0x5518ee4079ea6929ul, 14u, 12, 24593u},
@@ -76,9 +76,9 @@ static constexpr ::NPrivate::THashDivisor PRIME_DIVISORS_HOLDER[]{
#endif
static constexpr const ::NPrivate::THashDivisor* PRIME_DIVISORS = &PRIME_DIVISORS_HOLDER[1]; ///< Address of the first valid divisor
-static constexpr size_t PRIME_DIVISORS_SIZE = Y_ARRAY_SIZE(PRIME_DIVISORS_HOLDER) - 1; ///< Number of valid divisors without the guarding value
+static constexpr size_t PRIME_DIVISORS_SIZE = Y_ARRAY_SIZE(PRIME_DIVISORS_HOLDER) - 1; ///< Number of valid divisors without the guarding value
-unsigned long HashBucketCount(unsigned long elementCount) {
+unsigned long HashBucketCount(unsigned long elementCount) {
return HashBucketCountExt(elementCount)();
}
@@ -92,10 +92,10 @@ Y_CONST_FUNCTION
::NPrivate::THashDivisor HashBucketCountExt(unsigned long elementCount) {
if (elementCount <= PRIME_DIVISORS[0]()) {
return PRIME_DIVISORS[0];
- }
-
+ }
+
return HashBucketBoundedSearch(elementCount);
-}
+}
Y_CONST_FUNCTION
::NPrivate::THashDivisor HashBucketCountExt(unsigned long elementCount, int hint) {