From ac5815d994fe8ff151e0f13088891acc506662ed Mon Sep 17 00:00:00 2001 From: Kuan-Wei Chiu Date: Mon, 24 Jun 2024 05:51:55 +0800 Subject: Optimize bit counting using __builtin_popcount Use the __builtin_popcount intrinsic to optimize the bit counting function if the compiler supports it. This change replaces the manual bit counting algorithm with the more efficient built-in function, which leverages hardware support on compatible processors. This modification ensures that the code remains backward-compatible by falling back to the original implementation when __builtin_popcount is not available. --- include/afl-fuzz.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/afl-fuzz.h') diff --git a/include/afl-fuzz.h b/include/afl-fuzz.h index 6d03a74c..45600698 100644 --- a/include/afl-fuzz.h +++ b/include/afl-fuzz.h @@ -116,6 +116,10 @@ #include #endif +#ifndef __has_builtin + #define __has_builtin(x) 0 +#endif + #undef LIST_FOREACH /* clashes with FreeBSD */ #include "list.h" #ifndef SIMPLE_FILES -- cgit 1.4.1