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) {
|
if (distance == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int pos = 0;
|
seg.copyFrom(seg.asSlice(roff, woff - roff));
|
||||||
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++;
|
|
||||||
}
|
|
||||||
roff -= distance;
|
roff -= distance;
|
||||||
woff -= distance;
|
woff -= distance;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user