This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: Patch: java.nio.DirectBufferImpl.shiftDown()
- From: Per Bothner <per at bothner dot com>
- To: Michael Koch <konqueror at gmx dot de>
- Cc: java-patches at gcc dot gnu dot org
- Date: Wed, 21 Apr 2004 06:50:39 -0700
- Subject: Re: Patch: java.nio.DirectBufferImpl.shiftDown()
- References: <200404211405.25523.konqueror@gmx.de>
Michael Koch wrote:
Hi list,
On request of some people using java.nio with JNI I made
java.nio.DirectBufferImpl.shiftDown() static and removed an unecessary
usage of array_offset which is always 0 for direct buffers and is
intended only for buffers with backend arrays.
Per: whats your opinion about this ?
But what about a ShortViewBufferImpl that is created by calling
asShortBuffer on a DirectBufferImpl? You're now using the slow
shiftDown implementation in ByteBuffer instead of the much
faster native method.
Why do some implementations need DirectBufferImpl.shiftDown to
be static?
A possible solution: To your patch add to DirectBufferImpl:
void shiftDown (int dst_offset, int src_offset, int count)
{
shiftDown(address, dst_offset, srd_offset, count);
}
Same thing in MappedByteBuffer:
void shiftDown (int dst_offset, int src_offset, int count)
{
DirectByteBufferImpl.shiftDown(address, dst_offset, srd_offset, count);
}
--
--Per Bothner
per@bothner.com http://per.bothner.com/