Guest User

Untitled

a guest
Nov 29th, 2013
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. public byte Xor( byte a, byte b )
  2. {
  3. byte result = 0;
  4. for (int i = 0; i < 8; i++)
  5. {
  6. bool bitA = (1 << i) & a;
  7. bool bitB = (1 << i) & b;
  8. bool bitXor = !bitA && bitB || bitA && !bitB;
  9. result |= bitXor;
  10. result = result << 1;
  11. }
  12. return result;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment