Skip to content

Instantly share code, notes, and snippets.

@ttsugriy
Created August 27, 2023 22:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ttsugriy/df69ba55a57f64b2ddc591975aa90de8 to your computer and use it in GitHub Desktop.
Save ttsugriy/df69ba55a57f64b2ddc591975aa90de8 to your computer and use it in GitHub Desktop.
midpoint experiments for bench
int midpointb(int l, int r) {
return (l + r) >> 1;
}
int midpointw(int l, int r) {
return l + (r - l) / 2;
}
int midpoint(int l, int r) {
return static_cast<unsigned int>(l) + static_cast<unsigned int>(r) >> 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment