summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/FuzzerValueBitMap.h
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerValueBitMap.h')
-rw-r--r--llvm/lib/Fuzzer/FuzzerValueBitMap.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerValueBitMap.h b/llvm/lib/Fuzzer/FuzzerValueBitMap.h
index 493afc574cc..65659f21349 100644
--- a/llvm/lib/Fuzzer/FuzzerValueBitMap.h
+++ b/llvm/lib/Fuzzer/FuzzerValueBitMap.h
@@ -26,7 +26,7 @@ struct ValueBitMap {
// Computed a hash function of Value and sets the corresponding bit.
void AddValue(uintptr_t Value) {
- uintptr_t Idx = Value % kMapSizeInBits;
+ uintptr_t Idx = Value < kMapSizeInBits ? Value : Value % kMapSizeInBits;
uintptr_t WordIdx = Idx / kBitsInWord;
uintptr_t BitIdx = Idx % kBitsInWord;
Map[WordIdx] |= 1UL << BitIdx;
OpenPOWER on IntegriCloud