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
proposal: math/bits: add average of two integers #49303
Comments
What will these functions be called? What will their documentation be? Thanks. |
Also, who would use them? And why not just use |
They could be called |
I am not sure how to use |
I mentioned Doesn't the compiler already generate perfectly good code for |
See:
|
Btw, |
We actually have an instruction like this in SSA, as it is useful for strength reducing constant division to multiplication. See |
Another example:
|
It seems there is a non-trivial formula for averaging two signed/unsigned integers properly. I've added them to sixb v1.3.0. Please close this issue if you dont think |
Hi,
I am proposing to add efficient, low-level "average" functions for two signed / unsigned integers. In x86 assembly unsigned version could be written as:
Thanks..
The text was updated successfully, but these errors were encountered: