More: Don't use DataHelper.readLong() for 1-byte reads, for efficiency

This commit is contained in:
zzz
2015-11-08 20:43:42 +00:00
parent 1aed266f70
commit 1451dc6ece
12 changed files with 14 additions and 14 deletions

View File

@@ -585,7 +585,7 @@ class Packet {
cur += 4;
setAckThrough(DataHelper.fromLong(buffer, cur, 4));
cur += 4;
int numNacks = (int)DataHelper.fromLong(buffer, cur, 1);
int numNacks = buffer[cur] & 0xff;
cur++;
if (length < 22 + numNacks*4)
throw new IllegalArgumentException("Too small with " + numNacks + " nacks: " + length);
@@ -599,7 +599,7 @@ class Packet {
} else {
setNacks(null);
}
setResendDelay((int)DataHelper.fromLong(buffer, cur, 1));
setResendDelay(buffer[cur] & 0xff);
cur++;
setFlags((int)DataHelper.fromLong(buffer, cur, 2));
cur += 2;