Difference between revisions of "XOR (binary)"

From veswiki
Jump to: navigation, search
 
Line 8: Line 8:
 
     %01001010
 
     %01001010
  
Because only those bits are true in one byte or the other, but not both. The [[F8]] can only XOR two bytes at a time.
+
Because only those bits are true in one byte or the other, but not both. The [[F8]] can only XOR two bytes at a time.<br>
 
Basically, if they aren't the same you'll get 1, if they are the same you get 0.  
 
Basically, if they aren't the same you'll get 1, if they are the same you get 0.  
  
 
== See Also ==
 
== See Also ==
 
* [[Binary logic]]
 
* [[Binary logic]]

Latest revision as of 13:45, 12 April 2022

To XOR (eXclusive OR) one value with another is to compare the bits of each value, and only keep the ones which are true in one byte, not the other. For example, if you XOR'd these values:

    %01100100
    %00101110

You would get:

    %01001010

Because only those bits are true in one byte or the other, but not both. The F8 can only XOR two bytes at a time.
Basically, if they aren't the same you'll get 1, if they are the same you get 0.

See Also