提交 edf2e544 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Use bit mask to get even value in DataUtils.getFletcher32()

上级 dde366b2
......@@ -726,7 +726,7 @@ public final class DataUtils {
*/
public static int getFletcher32(byte[] bytes, int length) {
int s1 = 0xffff, s2 = 0xffff;
int i = 0, evenLength = length / 2 * 2;
int i = 0, evenLength = length & ~1;
while (i < evenLength) {
// reduce after 360 words (each word is two bytes)
for (int end = Math.min(i + 720, evenLength); i < end;) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论