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

Use "division-by-multiplication" scheme to fasten division #83

Open
Melirius opened this issue May 27, 2024 · 1 comment
Open

Use "division-by-multiplication" scheme to fasten division #83

Melirius opened this issue May 27, 2024 · 1 comment

Comments

@Melirius
Copy link
Collaborator

@mcroomp, unfortunately this is not working, not enough precision for all u16 range

let mut retval = (1u32 << 31) + v as u32 - 1;

Even 2^32 fails - first at 17215. A classical scheme from Warren should work, but it has variable shifts.

@Melirius
Copy link
Collaborator Author

I wanted to make this, but you are faster :)

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

No branches or pull requests

1 participant