1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 14:15:23 +02:00

[208166] Avoid unnecessary arraycopy in BoundedByteBuffer

This commit is contained in:
Martin Oberhuber 2007-10-31 00:47:20 +00:00
parent 0e1dd48e01
commit bfc803fd98

View file

@ -9,6 +9,7 @@
* Michael Scharf (Wind River) - initial API and implementation
* Douglas Lea (Addison Wesley) - [cq:1552] BoundedBufferWithStateTracking adapted to BoundedByteBuffer
* Martin Oberhuber (Wind River) - the waitForAvailable method
* Martin Oberhuber (Wind River) - [208166] Avoid unnecessary arraycopy in BoundedByteBuffer
*******************************************************************************/
package org.eclipse.tm.internal.terminal.textcanvas;
@ -100,7 +101,7 @@ public class PipedInputStream extends InputStream {
wait();
int n = Math.min(len, fBuffer.length - fPutPos);
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);
fPutPos = (fPutPos + len) % fBuffer.length; // cyclically increment
boolean wasEmpty = fUsedSlots == 0;