diff options
Diffstat (limited to 'src/java/com/jogamp/gluegen/runtime/PointerBuffer.java')
-rw-r--r-- | src/java/com/jogamp/gluegen/runtime/PointerBuffer.java | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/java/com/jogamp/gluegen/runtime/PointerBuffer.java b/src/java/com/jogamp/gluegen/runtime/PointerBuffer.java index ff1bc2e..0adbb36 100644 --- a/src/java/com/jogamp/gluegen/runtime/PointerBuffer.java +++ b/src/java/com/jogamp/gluegen/runtime/PointerBuffer.java @@ -33,7 +33,11 @@ package com.jogamp.gluegen.runtime; import java.nio.ByteBuffer; /** - * Hardware independent container for native long- and pointer arrays. + * Hardware independent container for native pointer arrays. + * + * The native values (NIO direct ByteBuffer) might be 32bit or 64bit wide, + * depending of the CPU pointer width. + * * @author Michael Bien * @author Sven Gothel */ @@ -87,7 +91,7 @@ public abstract class PointerBuffer { } public static int elementSize() { - return CPU.is32Bit() ? Buffers.SIZEOF_INT : Buffers.SIZEOF_LONG; + return Platform.is32Bit() ? Buffers.SIZEOF_INT : Buffers.SIZEOF_LONG; } public int limit() { @@ -152,4 +156,18 @@ public abstract class PointerBuffer { public abstract PointerBuffer put(long value); + public PointerBuffer put(PointerBuffer src) { + if (remaining() < src.remaining()) { + throw new IndexOutOfBoundsException(); + } + while (src.hasRemaining()) { + put(src.get()); + } + return this; + } + + public String toString() { + return "PointerBuffer[capacity "+capacity+", position "+position+", elementSize "+elementSize()+", ByteBuffer.capacity "+bb.capacity()+"]"; + } + } |