You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Try defining low and high to be unsigned. I suspect what you're seeing is the additional code required for signed division (signed /2 is not the same as >>1).
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Benchmarked this function
then replaced
with
and benchmarked again.
What did you expect to see?
Both functions are compiled to the same assembly and execute equally fast.
What did you see instead?
The one with division is a lot slower:
https://play.golang.org/p/VU9rZYff9AA
The text was updated successfully, but these errors were encountered: