pushrsp opened a new issue, #1457:
URL: https://github.com/apache/incubator-fury/issues/1457
Can i do some refactor for `MemoryBuffer` class?
e.g
```java
public void writeBoolean(boolean value) {
final int writerIdx = writerIndex;
final int newIdx = writerIdx + 1; <- we can replace this number to
static variable which make more understandable.
ensure(newIdx);
final long pos = address + writerIdx;
UNSAFE.putByte(heapMemory, pos, (byte) (value ? 1 : 0));
writerIndex = newIdx;
}
```
```java
public byte readByte() {
int readerIdx = readerIndex;
// every readX method use this for checking bound, so we can make short
for it.
if (BoundsChecking.BOUNDS_CHECKING_ENABLED && readerIdx > size - 1) {
throw new IndexOutOfBoundsException(
String.format(
"readerIndex(%d) + length(%d) exceeds size(%d): %s",
readerIdx, 1, size, this));
}
readerIndex = readerIdx + 1;
return UNSAFE.getByte(heapMemory, address + readerIdx);
}
```
--
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]