Skip to content

Commit

Permalink
fix snappy crc32c checksum
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Xie committed Feb 20, 2020
1 parent 5c458c9 commit 0c258c2
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ static int calculateChecksum(ByteBuf data, int offset, int length) {
Crc32c crc32 = new Crc32c();
try {
crc32.update(data, offset, length);
return maskChecksum((int) crc32.getValue());
return maskChecksum(crc32.getValue());
} finally {
crc32.reset();
}
Expand Down Expand Up @@ -656,6 +656,6 @@ static void validateChecksum(int expectedChecksum, ByteBuf data, int offset, int
* @return The masked checksum
*/
static int maskChecksum(int checksum) {
return (checksum >> 15 | checksum << 17) + 0xa282ead8;
return (int)((checksum >> 15 | checksum << 17) + 0xa282ead8);
}
}

0 comments on commit 0c258c2

Please sign in to comment.