The M-ary Alphabet Codes page describes how the “m” code values are distributed around the unit circle, with code 0 at coordinate (1,0) or 1\angle 180^\circ in polar form. By convention, let us assume that all other points are placed in sequence while traversing the unit circle in a counter clockwise manner.
Assuming m points are distributed around the unit circle, operations between two points, a and b, can be expressed as follows.
AND Operation
With binary values (m=2) AND operations can be described as follows:
a | b | a AND b |
0 | 0 | 0 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
Notice that “a AND b” is minimum of a and b. Knowing this, the relationship can be written more generally as:
a AND b = min(a,b)
OR Operation
With binary values (m=2) OR operations can be described as follows:
a | b | a OR b |
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 1 |
Notice that “a OR b” is maximum of a and b. Knowing this, the relationship can be written more generally as:
a OR b = max(a,b)
XOR Operation
With binary values (m=2) XOR operations can be described as follows:
a | b | a XOR b |
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
Notice that “a XOR b” is sum of a and b, modulo 2. Knowing this, the relationship can be written more generally as:
a XOR b = (a+b) % m
NOT Operation
With binary values (m=2) NOT operations can be described as follows:
a | NOT a |
0 | 1 |
1 | 0 |
Notice that “NOT a” is a incremented by 1 then modulo 2. Knowing this, the relationship can be written more generally as:
NOT a = (a+1) % m