or long version... long
the one is acting on the bit hence bit logic since the first number in bit is 1 (1,2,4,8,etc...) all the numbers in bit minus the first one are even so if one is on hence the & 1 the number has to be odd!
Also this was a very clever answer that made me go looking for how he got his answer which made me all the wiser thx!!
I agree with you, hermano. Bitwise multiplication is faster than modulo operation.
can someone please explain this one I'm a little lost!
Why is bit logic aplical here? Is it always aplicable when using int?
I have figured it out you can find a explaination here: https://code.tutsplus.com/articles/understanding-bitwise-operators--active-11301#:~:text=Bitwise%20operators%20are%20operators%20(just,use%20and%20also%20quite%20useful!
or long version... long
the one is acting on the bit hence bit logic since the first number in bit is 1 (1,2,4,8,etc...) all the numbers in bit minus the first one are even so if one is on hence the & 1 the number has to be odd!
Also this was a very clever answer that made me go looking for how he got his answer which made me all the wiser thx!!
I like this answer!!!!
Pay attention everyone, this is the 'superior' Even/Odd check, cause modulo = slower (micro-optimizations ftw)