Created
November 8, 2024 02:46
-
-
Save J-Moravec/bfef7b1879dd4c6e5fe8f2171a170b2c to your computer and use it in GitHub Desktop.
Is odd: bitwise or modulo?
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
is_odd_bitwise = \(x) bitwAnd(x, 1L) | |
is_odd_mod = \(x) x %% 2L | |
s = sample(1:1e7) | |
bench::mark(is_odd_bitwise(s), is_odd_mod(s)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment