1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Drop misleading comments about undefined behavior (GH-17532)

There is no undefined behavior here.  If `BitScan*()` returns zero, the
value written to the first parameter is undefined, but we return a
reasonable value.
This commit is contained in:
Christoph M. Becker
2025-01-26 22:50:52 +01:00
committed by GitHub
parent d6c6675bfe
commit ab996934eb

View File

@@ -60,7 +60,6 @@ ZEND_ATTRIBUTE_CONST static zend_always_inline int zend_ulong_ntz(zend_ulong num
#else
if (!BitScanForward(&index, num)) {
#endif
/* undefined behavior */
return SIZEOF_ZEND_LONG * 8;
}
@@ -98,7 +97,6 @@ ZEND_ATTRIBUTE_CONST static zend_always_inline int zend_ulong_nlz(zend_ulong num
#else
if (!BitScanReverse(&index, num)) {
#endif
/* undefined behavior */
return SIZEOF_ZEND_LONG * 8;
}