Skip to content

Commit

Permalink
Tiny bit shift optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosrafaelgn committed Jul 22, 2017
1 parent c1d0e05 commit 6d96fe7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/br/com/carlosrafaelgn/fplay/util/Serializer.java
Expand Up @@ -102,11 +102,11 @@ public static void serializeString(OutputStream os, String value) throws IOExcep
}

public static int deserializeInt(InputStream is) throws IOException {
return ((is.read() & 0xff) | ((is.read() & 0xff) << 8) | ((is.read() & 0xff) << 16) | ((is.read() & 0xff) << 24));
return ((is.read() & 0xff) | ((is.read() & 0xff) << 8) | ((is.read() & 0xff) << 16) | (is.read() << 24));
}

public static int deserializeInt(byte[] input, int offset) {
return (input[offset] & 0xff) | ((input[offset + 1] & 0xff) << 8) | ((input[offset + 2] & 0xff) << 16) | ((input[offset + 3] & 0xff) << 24);
return (input[offset] & 0xff) | ((input[offset + 1] & 0xff) << 8) | ((input[offset + 2] & 0xff) << 16) | (input[offset + 3] << 24);
}

public static long deserializeLong(InputStream is) throws IOException {
Expand Down

0 comments on commit 6d96fe7

Please sign in to comment.