This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: PATCH to use ByteBufferHelper more
Michael Koch wrote:
+ void shiftDown (int dst_offset, int src_offset, int count)
+ {
+ for (int i = 0; i < count; i++)
+ put(dst_offset + i, get(src_offset + i));
+ }
As far as I could see this method is called for moving data in non-direct buffers.
It would be nice to use System.arrayCopy. This makes the code more
ovious I think.
It don't think that would be correct for the abstract ByteBuffer, but I
added such an implementation for ByteBufferImpl:
void shiftDown (int dst_offset, int src_offset, int count)
{
System.arraycopy(backing_buffer, array_offset + src_offset,
backing_buffer, array_offset + dst_offset,
count);
}
I noticed what looks like a bug: Shouldn't the get/put methods in
ByteBufferImpl add the array_offset to the index? There may be
other places where use of array_offset should be reviewed.
--
--Per Bothner
per@bothner.com http://per.bothner.com/