diff options
| author | Kostya Serebryany <kcc@google.com> | 2016-09-23 23:51:58 +0000 |
|---|---|---|
| committer | Kostya Serebryany <kcc@google.com> | 2016-09-23 23:51:58 +0000 |
| commit | 0800b81a21c5e3967294851db9278fbd5a9dd340 (patch) | |
| tree | 7ec4ed29d3dbb16e97ad4c24764814da5b9aa6e9 /llvm/lib/Fuzzer/FuzzerValueBitMap.h | |
| parent | 5ab97ec2f6a67b42e7ab7c9f1164edbbb4831404 (diff) | |
| download | bcm5719-llvm-0800b81a21c5e3967294851db9278fbd5a9dd340.tar.gz bcm5719-llvm-0800b81a21c5e3967294851db9278fbd5a9dd340.zip | |
[libFuzzer] simplify HandleTrace again, start re-running interesting units and collecting their features.
llvm-svn: 282316
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerValueBitMap.h')
| -rw-r--r-- | llvm/lib/Fuzzer/FuzzerValueBitMap.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerValueBitMap.h b/llvm/lib/Fuzzer/FuzzerValueBitMap.h index fdc92189b47..bc191e49fae 100644 --- a/llvm/lib/Fuzzer/FuzzerValueBitMap.h +++ b/llvm/lib/Fuzzer/FuzzerValueBitMap.h @@ -23,6 +23,7 @@ struct ValueBitMap { static const size_t kBitsInWord = (sizeof(uintptr_t) * 8); static const size_t kMapSizeInWords = kMapSizeInBitsAligned / kBitsInWord; public: + static const size_t kNumberOfItems = kMapSizeInBits; // Clears all bits. void Reset() { memset(Map, 0, sizeof(Map)); } @@ -38,6 +39,13 @@ struct ValueBitMap { return New != Old; } + inline bool Get(uintptr_t Idx) { + assert(Idx < kMapSizeInBits); + uintptr_t WordIdx = Idx / kBitsInWord; + uintptr_t BitIdx = Idx % kBitsInWord; + return Map[WordIdx] & (1UL << BitIdx); + } + size_t GetNumBitsSinceLastMerge() const { return NumBits; } // Merges 'Other' into 'this', clears 'Other', updates NumBits, |

