diff options
author | van Hauser <vh@thc.org> | 2024-07-01 08:57:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-01 08:57:38 +0200 |
commit | 53409530b369e560c7f6f37ead5a5db9e116efd0 (patch) | |
tree | 6449fa84e6b9e26849d298af881014b18f55dc0b /src/afl-fuzz-bitmap.c | |
parent | 36db3428ab16156dd72196213d2a02a5eadaed11 (diff) | |
parent | 43014cd465eec8cc47eda041802001776dbb5dd5 (diff) | |
download | afl++-53409530b369e560c7f6f37ead5a5db9e116efd0.tar.gz |
Merge pull request #2141 from AFLplusplus/dev
push to stable
Diffstat (limited to 'src/afl-fuzz-bitmap.c')
-rw-r--r-- | src/afl-fuzz-bitmap.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/afl-fuzz-bitmap.c b/src/afl-fuzz-bitmap.c index 03bc5d6c..97ccd3d3 100644 --- a/src/afl-fuzz-bitmap.c +++ b/src/afl-fuzz-bitmap.c @@ -75,9 +75,13 @@ u32 count_bits(afl_state_t *afl, u8 *mem) { } +#if __has_builtin(__builtin_popcount) + ret += __builtin_popcount(v); +#else v -= ((v >> 1) & 0x55555555); v = (v & 0x33333333) + ((v >> 2) & 0x33333333); ret += (((v + (v >> 4)) & 0xF0F0F0F) * 0x01010101) >> 24; +#endif } @@ -459,7 +463,7 @@ save_if_interesting(afl_state_t *afl, void *mem, u32 len, u8 fault) { if (unlikely(fault == FSRV_RUN_TMOUT && afl->afl_env.afl_ignore_timeouts)) { - if (likely(afl->schedule >= FAST && afl->schedule <= RARE)) { + if (unlikely(afl->schedule >= FAST && afl->schedule <= RARE)) { classify_counts(&afl->fsrv); u64 cksum = hash64(afl->fsrv.trace_bits, afl->fsrv.map_size, HASH_CONST); @@ -485,7 +489,7 @@ save_if_interesting(afl_state_t *afl, void *mem, u32 len, u8 fault) { /* Generating a hash on every input is super expensive. Bad idea and should only be used for special schedules */ - if (likely(afl->schedule >= FAST && afl->schedule <= RARE)) { + if (unlikely(afl->schedule >= FAST && afl->schedule <= RARE)) { classify_counts(&afl->fsrv); classified = 1; |