Binary is indeed the easiest and most straightforward way to see number parity. You only need to check one bit.
Comment on I wish
TheBlue22@lemmy.blahaj.zone 1 year agoExcept maybe in C++ where the makers must have found some bit-fucking method that saves 0.02ms
bouh@lemmy.world 1 year ago
TheBlue22@lemmy.blahaj.zone 1 year ago
Its fasicnating that pretty much any function can be rewritten and improved drastically by either bit magic or assembly magic.
Wilzax@lemmy.world 1 year ago
for an unsigned int, do
(myNum & 1) == 0;
TheBlue22@lemmy.blahaj.zone 1 year ago
I haven’t done binary in years so ill just trust you this works
Gutek8134@lemmy.world 1 year ago
Checks if least significant bit is equal to zero
TheBlue22@lemmy.blahaj.zone 1 year ago
Ah yeah, I do remember my basics of hardware classes.