3 ms·
When I wrote in ASM, I always used to look at the LSB (Least Significant Bit). If it was zero, then the number was even. Things are probably different, these d
by ChrisMarshallNY 2y ago
When I wrote in ASM, I always used to look at the LSB (Least Significant Bit). If it was zero, then the number was even.
Things are probably different, these days, so maybe that isn’t effective.
- ChrisMarshallNY 2y agoJust to add some closure. This is how I'd do it in Swift: extension FixedWidthInteger { var isEven: Bool { 0 == 1 & self } }