mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8247619: Improve Direct Buffering of Characters
Reviewed-by: alanb, ahgross, rhalade, psandoz
This commit is contained in:
parent
0408b23bcf
commit
a5367cbb7a
3 changed files with 27 additions and 12 deletions
|
@ -313,8 +313,8 @@ public abstract class Buffer {
|
|||
public Buffer position(int newPosition) {
|
||||
if (newPosition > limit | newPosition < 0)
|
||||
throw createPositionException(newPosition);
|
||||
if (mark > newPosition) mark = -1;
|
||||
position = newPosition;
|
||||
if (mark > position) mark = -1;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -503,7 +503,8 @@ public abstract class Buffer {
|
|||
* @return The number of elements remaining in this buffer
|
||||
*/
|
||||
public final int remaining() {
|
||||
return limit - position;
|
||||
int rem = limit - position;
|
||||
return rem > 0 ? rem : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue