Bitwise XOR
Otherwise known as the exclusive OR
operator, written as ^
, bitwise XOR
compares two inputs and returns 1 when the two inputs are different (see Figure 7.7).
Notice in this example that only the comparisons where input 1 and input 2 are different result in a 1. Matching 1s (1 and 1) returns 0 and matching 0s (0 and 0) returns 0.
Get Learning Swift™ Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.