Created
July 22, 2023 22:11
-
-
Save ttsugriy/59fddcb54f29de6fd829e27e564a2500 to your computer and use it in GitHub Desktop.
different midpoints in C++
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 + r) >> 1; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment