Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public byte Xor( byte a, byte b )
- {
- byte result = 0;
- for (int i = 0; i < 8; i++)
- {
- bool bitA = (1 << i) & a;
- bool bitB = (1 << i) & b;
- bool bitXor = !bitA && bitB || bitA && !bitB;
- result |= bitXor;
- result = result << 1;
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment