Optimize AbstractByteBuf.adjustMarkers()
This commit is contained in:
parent
3a52cc410a
commit
8f7fba2d39
@ -195,8 +195,19 @@ public abstract class AbstractByteBuf implements ByteBuf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void adjustMarkers(int decrement) {
|
protected void adjustMarkers(int decrement) {
|
||||||
markedReaderIndex = Math.max(markedReaderIndex - decrement, 0);
|
int markedReaderIndex = this.markedReaderIndex;
|
||||||
markedWriterIndex = Math.max(markedWriterIndex - decrement, 0);
|
if (markedReaderIndex <= decrement) {
|
||||||
|
this.markedReaderIndex = 0;
|
||||||
|
int markedWriterIndex = this.markedWriterIndex;
|
||||||
|
if (markedWriterIndex <= decrement) {
|
||||||
|
this.markedWriterIndex = 0;
|
||||||
|
} else {
|
||||||
|
this.markedWriterIndex = markedWriterIndex - decrement;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.markedReaderIndex = markedReaderIndex - decrement;
|
||||||
|
markedWriterIndex -= decrement;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user