Skip to content

Commit

Permalink
Drop misleading comments about undefined behavior (GH-17532)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cmb69 authored Jan 26, 2025
1 parent d6c6675 commit ab99693
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions Zend/zend_bitset.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit ab99693

Please sign in to comment.