How can I do a logical NAND on two numbers in python? Simple example. Let's say I have a number (0xFF) and I want a logical NAND with a mask value of 0x5.
number = 0xFF = 0b1111 1111
mask = 0x05 = 0b0000 0101
---------------------------
desired= 0xFA = 0b1111 1010
I'm not reinventing the wheel here, this seems like it should be easily accomplished, but I'm stumped and I cannot find any solutions online. I can loop through the number and do a "not (number & mask)" at each bit position and reassemble the value I want, but that seems like more work than is needed here.