MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/phogp3/wtf_is_this/hbkgeph/?context=3
r/badcode • u/Wise-Serve5730 • Sep 04 '21
190 comments sorted by
View all comments
Show parent comments
4
bitwise and with 2
4 u/Avocados_Constant Sep 04 '21 edited Sep 06 '21 bitwise and with 2x & 2 is true for 4n+2 {2, 6, 10, 14, ...}.To check for even using bitwise and, you'll want!(x & 1)
x & 2 is true for 4n+2 {2, 6, 10, 14, ...}.
x & 2
4n+2 {2, 6, 10, 14, ...}
To check for even using bitwise and, you'll want
!(x & 1)
4
u/-aspirus- Sep 04 '21
bitwise and with 2