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

Simplify pack_size() and pack_size128() #199

Merged
merged 1 commit into from
Oct 29, 2023
Merged

Simplify pack_size() and pack_size128() #199

merged 1 commit into from
Oct 29, 2023

Conversation

moubctez
Copy link
Contributor

pack_size() and pack_size128() can be written in more compact form, taking advantage of CPU capabilities of counting leading zeros in a number. I've quickly checked that pack_size() on Aarch64 it shrinks down from 27 to 5 opcodes, and on X86_64: from 26 to 8.

Copy link
Owner

@BurntSushi BurntSushi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thank you!

@BurntSushi BurntSushi merged commit 2e17045 into BurntSushi:master Oct 29, 2023
13 checks passed
@moubctez moubctez deleted the simplify_pack_size branch October 30, 2023 10:09
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