+2004-04-21 Michael Koch <konqueror@gmx.de>
+
+ * java/nio/DirectByteBufferImpl.java
+ (shiftDown): Made static, give address as argument and
+ provide a convenience method that overwrites shiftDown in
+ ByteBufferImpl and calls the native shiftDown.
+ * java/nio/MappedByteBufferImpl.java
+ (): Use optimized method in DirectByteBufferImpl.
+ * java/nio/natDirectByteBufferImpl.cc
+ (shiftDown): Changed method signature. Removed usage of array_offset.
+
2004-04-21 Michael Koch <konqueror@gmx.de>
* gnu/java/net/natPlainSocketImplPosix.cc
return this;
}
- native void shiftDown (int dst_offset, int src_offset, int count);
+ static native void shiftDown(RawData address, int dst_offset, int src_offset, int count);
+ void shiftDown(int dst_offset, int src_offset, int count)
+ {
+ shiftDown(address, dst_offset, src_offset, count);
+ }
+
public ByteBuffer compact ()
{
int pos = position();
if (pos > 0)
{
int count = remaining();
- shiftDown(0, pos, count);
+ shiftDown(address, 0, pos, count);
position(count);
limit(capacity());
}
if (pos > 0)
{
int count = remaining();
- shiftDown(0, pos, count);
+ // Call shiftDown method optimized for direct buffers.
+ DirectByteBufferImpl.shiftDown(address, 0, pos, count);
position(count);
limit(capacity());
}
void
java::nio::DirectByteBufferImpl::shiftDown
-(jint dst_offset, jint src_offset, jint count)
+(RawData* address, jint dst_offset, jint src_offset, jint count)
{
- jbyte* dst = reinterpret_cast<jbyte*> (address) + array_offset + dst_offset;
- jbyte* src = reinterpret_cast<jbyte*> (address) + array_offset + src_offset;
+ jbyte* dst = reinterpret_cast<jbyte*> (address) + dst_offset;
+ jbyte* src = reinterpret_cast<jbyte*> (address) + src_offset;
::memmove(dst, src, count);
}