Skip to content

🐛 Fix fallback implementation of bit_ceil#307

Merged
elbeno merged 1 commit intointel:mainfrom
elbeno:fix-fallback-bit-ceil
Jan 5, 2026
Merged

🐛 Fix fallback implementation of bit_ceil#307
elbeno merged 1 commit intointel:mainfrom
elbeno:fix-fallback-bit-ceil

Conversation

@elbeno
Copy link
Contributor

@elbeno elbeno commented Jan 1, 2026

Problem:

  • The fallback implementation of bit_ceil is implemented incorrectly. In particular it returns the wrong values for exact powers of 2.

Solution:

  • Fix the calculation: subtracting 1 before calculating the bit width is appropriate.

Notes:

@elbeno elbeno force-pushed the fix-fallback-bit-ceil branch from 5a7934a to 48a3137 Compare January 1, 2026 21:19
Problem:
- The fallback implementation of `bit_ceil` is implemented incorrectly. In
  particular it returns the wrong values for exact powers of 2.

Solution:
- Fix the calculation: subtracting 1 before calculating the bit width is
  appropriate.

Notes:
- Thanks to Walter Brown for pointing out this issue in private correspondence.
- Undoubtedly, this was missed because of issue intel#117.
@elbeno elbeno force-pushed the fix-fallback-bit-ceil branch from 48a3137 to feef4dd Compare January 1, 2026 21:20
@elbeno elbeno merged commit 9a6297d into intel:main Jan 5, 2026
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants