They look fine to me.

+/* (x & y) + (x ^ y) -> x | y */

This also works if you replace + with | or ^.

+/* (x | y) - (x ^ y) -> x & y */

For symmetry, you probably also want:
(x | y) - (x & y) -> x ^ y

(they both also work with ^ instead of -)

+/* (x & y) + (x | y) -> x + y */

Again for symmetry, it seems like this comes with
x + y - (x | y) -> x & y
x + y - (x & y) -> x | y
which seem fine when overflow is undefined or wraps, but not if for instance it saturates.

--
Marc Glisse

Reply via email to