diff options
author | Tor Egge <Tor.Egge@broadpark.no> | 2021-03-17 22:35:08 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@broadpark.no> | 2021-03-17 22:36:18 +0100 |
commit | 329b61e0b112ad26e435022b17cf1c2310973565 (patch) | |
tree | b2eaa4f49cd67c1c9597f257664df189df698072 /document/src | |
parent | a564c97505dbde170ddda41c6ab9ba7ecdd71aee (diff) |
Keep BucketId mask anomalies for zero used bits.
Diffstat (limited to 'document/src')
-rw-r--r-- | document/src/vespa/document/bucket/bucketid.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/document/src/vespa/document/bucket/bucketid.cpp b/document/src/vespa/document/bucket/bucketid.cpp index 1b9cf1e5304..e2d56546ca2 100644 --- a/document/src/vespa/document/bucket/bucketid.cpp +++ b/document/src/vespa/document/bucket/bucketid.cpp @@ -45,7 +45,7 @@ void fillUsedMasks(BucketId::Type * masks, uint8_t maxBits) typedef BucketId::Type Type; for (uint32_t usedBits = 0; usedBits <= maxBits; ++usedBits) { uint8_t notused = 8 * sizeof(Type) - usedBits; - masks[usedBits] = (std::numeric_limits<Type>::max() << notused) >> notused; + masks[usedBits] = (usedBits > 0) ? ((std::numeric_limits<Type>::max() << notused) >> notused) : std::numeric_limits<Type>::max(); } } @@ -54,7 +54,7 @@ void fillStripMasks(BucketId::Type * masks, uint8_t maxBits) typedef BucketId::Type Type; for (uint32_t usedBits = 0; usedBits <= maxBits; ++usedBits) { uint8_t notused = 8 * sizeof(Type) - usedBits; - Type usedMask = (std::numeric_limits<Type>::max() << notused) >> notused; + Type usedMask = (usedBits > 0) ? ((std::numeric_limits<Type>::max() << notused) >> notused) : std::numeric_limits<Type>::max(); Type countMask = (std::numeric_limits<Type>::max() >> maxBits) << maxBits; masks[usedBits] = usedMask | countMask; } |