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

Add popcount, clz, ctz primitives #94

Merged
merged 1 commit into from
Jan 19, 2025
Merged

Conversation

konsumlamm
Copy link
Contributor

Closes #92.

Implement primops for popcount, clz (count leading zeros) and ctz (count trailing zeros).

They use builtins for MSVC, GCC and Clang. The default implementation has #ifs for GCC and Clang, since those are the most common compilers, to avoid having to repeat those checks for the different platforms.

@augustss
Copy link
Owner

Looks great! Thanks!

@augustss augustss merged commit 8681ea7 into augustss:master Jan 19, 2025
13 checks passed
@konsumlamm konsumlamm deleted the bitcount branch January 19, 2025 15:28
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.

Builtin popcount, clz, ctz
2 participants