Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Looks like people are slowly forgetting about the modulus operator | Better HN
Looks like people are slowly forgetting about the modulus operator
(twitter.com)
4 points · by
narmak
· 8y ago · 1 comment
Comments
[–]
WeEatnKid
8y ago
This particular use case (checking odd or even) doesn't even need to use the modulus operation -- which is expensive. A bitwise AND is much more efficient (provided that the compiler doesn't apply that optimization upon seeing % 2)
X on X
X on X
X (formerly Twitter)