Q:

Bitwise operator to convert 0 to 1 and 1 to 0

In C, suppose I have an unsigned char A which can be either 0 or 1.
I would like to find a bitwise logical operator that will convert
A to !A.
Note: I am using this code on a GPU, where bitwise operators are very cheap compared to logical operators. i.e. XOR is much cheaper than !

A:

If by 'not' you mean send 1 to 0 and 0 to 1. you can use the XOR operator ^ to do that. If character is called c, you can write c = c ^ 1;.

A:

You should use the "logical not" operator:
A = !A;
You can also use the "bitwise not" operator, but this will make your code harder to understand since what you are doing is actually a logical not:
A = ~A;

