From 106783a41c2c0c7a855e18df50d90e2ece9353d9 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sun, 19 Jan 2025 20:41:11 +0000 Subject: [PATCH] zend_ulong_ntz/zend_ulong_ntz little optimisation for windows. because of the unix code path, UB is avoided beforehand thus errors with 0 mask for the windows api is unlikely. --- Zend/zend_bitset.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Zend/zend_bitset.h b/Zend/zend_bitset.h index a42b35712f4e..2e0536b166be 100644 --- a/Zend/zend_bitset.h +++ b/Zend/zend_bitset.h @@ -56,9 +56,9 @@ ZEND_ATTRIBUTE_CONST static zend_always_inline int zend_ulong_ntz(zend_ulong num unsigned long index; #if defined(_WIN64) - if (!BitScanForward64(&index, num)) { + if (UNEXPECTED(!BitScanForward64(&index, num))) { #else - if (!BitScanForward(&index, num)) { + if (UNEXPECTED(!BitScanForward(&index, num))) { #endif /* undefined behavior */ return SIZEOF_ZEND_LONG * 8; @@ -94,9 +94,9 @@ ZEND_ATTRIBUTE_CONST static zend_always_inline int zend_ulong_nlz(zend_ulong num unsigned long index; #if defined(_WIN64) - if (!BitScanReverse64(&index, num)) { + if (UNEXPECTED(!BitScanReverse64(&index, num))) { #else - if (!BitScanReverse(&index, num)) { + if (UNEXPECTED(!BitScanReverse(&index, num))) { #endif /* undefined behavior */ return SIZEOF_ZEND_LONG * 8;