[llvm] r278856 - [libFuzzer] minor speed improvement

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 16 14:28:05 PDT 2016


Author: kcc
Date: Tue Aug 16 16:28:05 2016
New Revision: 278856

URL: http://llvm.org/viewvc/llvm-project?rev=278856&view=rev
Log:
[libFuzzer] minor speed improvement

Modified:
    llvm/trunk/lib/Fuzzer/FuzzerValueBitMap.h

Modified: llvm/trunk/lib/Fuzzer/FuzzerValueBitMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerValueBitMap.h?rev=278856&r1=278855&r2=278856&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerValueBitMap.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerValueBitMap.h Tue Aug 16 16:28:05 2016
@@ -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;




More information about the llvm-commits mailing list