Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: constify bitwise and shift functions #441

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DaniPopes
Copy link
Contributor

@DaniPopes DaniPopes commented Feb 27, 2025

  • Adds const fn <op> for all bitwise and, or, xor
  • Makes is_zero, *shl, *shr, rotate*, count* const

WIP: is_zero actually performs worse because we have to manually implement equality, and I cannot get the compiler to generate optimal code. See https://godbolt.org/z/aM1nE1Pfh

@DaniPopes DaniPopes requested a review from prestwich as a code owner February 27, 2025 14:19
@prestwich
Copy link
Collaborator

just needs changelog

- Adds `const fn <op>` for all bitwise and, or, xor
- Makes `is_zero`, `*shl`, `*shr`, `rotate*`, `count*` const
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