Monday, September 10, 2007

Two Equivalent Bitwise Exps

(a & b) | (a & c) | (b & c)

(a | b) & (a | c) & (b | c)

at each bit of a, b and c, at least two of them should have 1.


Updates: [tested]
in Java, this applies for types like int, char, Integer, long, etc
Doesn't work for float, String, double.

No comments: