LiangliangSui commented on code in PR #1650:
URL: https://github.com/apache/incubator-fury/pull/1650#discussion_r1618881357
##########
java/fury-core/src/main/java/org/apache/fury/memory/MemoryBuffer.java:
##########
@@ -1774,7 +1774,7 @@ private long readVarUint36Slow() {
/** Reads the 1-5 byte int part of a non-negative varint. */
public int readVarUint32() {
int readIdx = readerIndex;
- if (size - readIdx < 5) {
+ if (size - readIdx < 4) {
Review Comment:
So the five consecutive `getByte` calls in `readVarUint36Slow` are no
different from `UNSAFE.getInt + UNSAFE.getByte`. They all have read checks for
`(fourByteValue & 0x80000000) != 0` and `(b & 0x80) != 0`.
We only need to ensure that `size - readIdx >= 4` to use `UNSAFE.getInt` to
read the content normally.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]