mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-28 11:25:35 +02:00
[208166] Avoid unnecessary arraycopy in BoundedByteBuffer
This commit is contained in:
parent
0e1dd48e01
commit
bfc803fd98
1 changed files with 2 additions and 1 deletions
|
@ -9,6 +9,7 @@
|
||||||
* Michael Scharf (Wind River) - initial API and implementation
|
* Michael Scharf (Wind River) - initial API and implementation
|
||||||
* Douglas Lea (Addison Wesley) - [cq:1552] BoundedBufferWithStateTracking adapted to BoundedByteBuffer
|
* Douglas Lea (Addison Wesley) - [cq:1552] BoundedBufferWithStateTracking adapted to BoundedByteBuffer
|
||||||
* Martin Oberhuber (Wind River) - the waitForAvailable method
|
* Martin Oberhuber (Wind River) - the waitForAvailable method
|
||||||
|
* Martin Oberhuber (Wind River) - [208166] Avoid unnecessary arraycopy in BoundedByteBuffer
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.tm.internal.terminal.textcanvas;
|
package org.eclipse.tm.internal.terminal.textcanvas;
|
||||||
|
@ -100,7 +101,7 @@ public class PipedInputStream extends InputStream {
|
||||||
wait();
|
wait();
|
||||||
int n = Math.min(len, fBuffer.length - fPutPos);
|
int n = Math.min(len, fBuffer.length - fPutPos);
|
||||||
System.arraycopy(b, off, fBuffer, fPutPos, n);
|
System.arraycopy(b, off, fBuffer, fPutPos, n);
|
||||||
if (fPutPos + len > n)
|
if (fPutPos + len > fBuffer.length)
|
||||||
System.arraycopy(b, off + n, fBuffer, 0, len - n);
|
System.arraycopy(b, off + n, fBuffer, 0, len - n);
|
||||||
fPutPos = (fPutPos + len) % fBuffer.length; // cyclically increment
|
fPutPos = (fPutPos + len) % fBuffer.length; // cyclically increment
|
||||||
boolean wasEmpty = fUsedSlots == 0;
|
boolean wasEmpty = fUsedSlots == 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue