Implement bit-wise complement operator ~
boeckmann opened this issue · comments
VASM has it. I consider this to be different to the logical not ! operator. ! returns 0 or 1 depending on its argument. ~ toggles the bits. It is also not redundant to x ^ $FFFF IF only the bitsare toggled according to the type. So 1 becomes $FE and not $FFFE. One may write x ^ $FF, but then one has to remember the type.
Operator priority should be higher than that of the logical operators.
Bit-wise complement operator ~ has precedence one below primary, so in
~A & ~b, ~A and ~B are evaluated first.
! has also high priority one below primary, so the following:
.if !A || B
Is evaluated as (!A) || B. The following two lines are equivalent:
.ifn A || B
.if !(A || B)
That gives reason for .ifn to spare some braces, and ! intuitively does the right thing.