Frank Heckenbach wrote:
not a := -1 - a
a xor b := (a or b) and not (a and b)
Where N shall be a power of 2 larger than the absolute values of a and b:
a or b := not (not a and not b) if a, b < 0 (a - N) or b if a >= 0 > b b or a if b >= 0 > a ((a - N) or (b - N)) + N if a, b >= 0
a and b := not (not a or not b) if a, b < 0 a and (b + N) if a >= 0 > b b and a if b >= 0 > a 0 if a = 0 or b = 0
For a, b > 0, where M shall be the largest power of 2 not larger than both a and b:
a and b := M + ((a - M) and (b - M)) if a, b >= M (a - M) and b if a >= M > b a and (b - M) if b >= M > a
We also have shl and shr and I suggest adding rol and ror (rotate left and rotate right).
Regards,
Adriaan van Os