Simplify MemSegBuf.compact implementation
This commit is contained in:
parent
0f303c7971
commit
252ac38305
@ -393,16 +393,7 @@ class MemSegBuf extends RcSupport<Buf, MemSegBuf> implements Buf {
|
||||
if (distance == 0) {
|
||||
return;
|
||||
}
|
||||
int pos = 0;
|
||||
var cursor = openCursor();
|
||||
while (cursor.readLong()) {
|
||||
setLongAtOffset(seg, pos, ByteOrder.BIG_ENDIAN, cursor.getLong());
|
||||
pos += Long.BYTES;
|
||||
}
|
||||
while (cursor.readByte()) {
|
||||
setByteAtOffset(seg, pos, cursor.getByte());
|
||||
pos++;
|
||||
}
|
||||
seg.copyFrom(seg.asSlice(roff, woff - roff));
|
||||
roff -= distance;
|
||||
woff -= distance;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user