fix: off-by-one error in binary_count_trailing_zeros for zero input
## Description
"The function returns `0` for `a == 0`, but mathematically, trailing zeros in binary representation of 0 are undefined (or conventionally treated as infinite). While `log2(a & -a)` fails for `a=0`, the current fallback to `0` is inconsistent with the documented behavior: `binary_count_trailing_zeros(16)` returns `4`, but `0` has infinitely many trailing zeros — returning `0` is misleading and could cause bugs in algorithms relying on this (e.g., bit manipulation loops expecting correct trailing zero counts)."
**Severity**: `high`
**File**: `bit_manipulation/binary_count_trailing_zeros.py`
## Expected Behavior
This should be handled properly to prevent runtime errors or degraded reliability.
0 条评论