Is there an existing Python library that directly supports all binary bitwise operations with ints? Python has binary bitwise operations "and" (a & b), "xor" (a ^ b), "or" (a | b) and unary "not" (~ a). Formulas like (a & ~b), (a | ~b), (a ^ ~b), ~(a & b), ~(a | b) involve two or more operations and are less efficient. I'm looking for an existing library that has a single operation for each of them with (a & ~b) is as fast as (a & b) and so on. Continue reading...