Skip to content

Instantly share code, notes, and snippets.

@benjamingeiger
Created October 4, 2012 18:34
Show Gist options
  • Save benjamingeiger/3835506 to your computer and use it in GitHub Desktop.
Save benjamingeiger/3835506 to your computer and use it in GitHub Desktop.
XOR method with type error.
private static byte[] xor(byte[] left, byte[] right, int len)
{
byte[] output = new byte[len];
for (int i = 0; i < len; i++) {
output[i] = (byte) ((byte) left[i]) ^ ((byte) right[i]);
}
return output;
}
/*
GroundRound.java:41: possible loss of precision
found : int
required: byte
output[i] = (byte) ((byte) left[i]) ^ ((byte) right[i]);
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment