Skip to content

Commit

Permalink
fix readInt bug
Browse files Browse the repository at this point in the history
  • Loading branch information
leonchen83 authored Sep 23, 2016
1 parent 374830e commit 2910969
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ public int readInt(int length, boolean littleEndian) throws IOException {
r = (r << 8) | v;
}
}
return r;
int c;
return r << (c = (4 - length << 3)) >> c;
}

public long readUInt(int length) throws IOException {
Expand All @@ -138,7 +139,8 @@ public int readInt(byte[] bytes, boolean littleEndian) {
r = (r << 8) | v;
}
}
return r;
int c;
return r << (c = (4 - length << 3)) >> c;
}

public long readLong(int length, boolean littleEndian) throws IOException {
Expand Down

0 comments on commit 2910969

Please sign in to comment.