From cc6034576a73f2d2559595fd0f1e5c5ba7825e58 Mon Sep 17 00:00:00 2001 From: goro9 Date: Fri, 22 Jan 2021 18:19:22 +0900 Subject: [PATCH] add ifndef directive to definition of likely and unlikely --- picohttpparser.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/picohttpparser.c b/picohttpparser.c index 5e5783a..c0a78c8 100644 --- a/picohttpparser.c +++ b/picohttpparser.c @@ -37,12 +37,20 @@ #include "picohttpparser.h" #if __GNUC__ >= 3 +#ifndef likely #define likely(x) __builtin_expect(!!(x), 1) +#endif +#ifndef unlikely #define unlikely(x) __builtin_expect(!!(x), 0) +#endif #else +#ifndef likely #define likely(x) (x) +#endif +#ifndef unlikely #define unlikely(x) (x) #endif +#endif #ifdef _MSC_VER #define ALIGNED(n) _declspec(align(n))