diff options
Diffstat (limited to 'src/java')
10 files changed, 288 insertions, 310 deletions
diff --git a/src/java/com/jogamp/gluegen/runtime/AbstractBuffer.java b/src/java/com/jogamp/gluegen/runtime/AbstractBuffer.java new file mode 100644 index 0000000..34e39ba --- /dev/null +++ b/src/java/com/jogamp/gluegen/runtime/AbstractBuffer.java @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2010, Sven Gothel + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Sven Gothel nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Sven Gothel BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Created on Saturday, March 27 2010 11:55 + */ +package com.jogamp.gluegen.runtime; + +import java.nio.ByteBuffer; +import java.nio.Buffer; +import java.util.HashMap; + +/** + * @author Michael Bien + * @author Sven Gothel + */ +public abstract class AbstractBuffer { + + protected final ByteBuffer bb; + protected int capacity; + protected int position; + + static { + NativeLibrary.ensureNativeLibLoaded(); + } + + protected AbstractBuffer(ByteBuffer bb, int elementSize) { + this.bb = bb; + + capacity = bb.capacity() / elementSize; + position = 0; + } + + public final int limit() { + return capacity; + } + + public final int capacity() { + return capacity; + } + + public final int position() { + return position; + } + + public final AbstractBuffer position(int newPos) { + if (0 > newPos || newPos >= capacity) { + throw new IndexOutOfBoundsException("Sorry to interrupt, but the position "+newPos+" was out of bounds. " + + "My capacity is "+capacity()+"."); + } + position = newPos; + return this; + } + + public final int remaining() { + return capacity - position; + } + + public final boolean hasRemaining() { + return position < capacity; + } + + public final AbstractBuffer rewind() { + position = 0; + return this; + } + + public boolean hasArray() { + return false; + } + + public int arrayOffset() { + return 0; + } + + public final ByteBuffer getBuffer() { + return bb; + } + + public final boolean isDirect() { + return bb.isDirect(); + } + + public String toString() { + return "AbstractBuffer[capacity "+capacity+", position "+position+", elementSize "+(bb.capacity()/capacity)+", ByteBuffer.capacity "+bb.capacity()+"]"; + } + +} diff --git a/src/java/com/jogamp/gluegen/runtime/AbstractLongBuffer.java b/src/java/com/jogamp/gluegen/runtime/AbstractLongBuffer.java new file mode 100644 index 0000000..63c2b5f --- /dev/null +++ b/src/java/com/jogamp/gluegen/runtime/AbstractLongBuffer.java @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2010, Michael Bien + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Michael Bien nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Michael Bien BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Created on Saturday, March 27 2010 11:55 + */ +package com.jogamp.gluegen.runtime; + +import java.nio.ByteBuffer; +import java.nio.Buffer; +import java.util.HashMap; + +/** + * 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 + */ +public abstract class AbstractLongBuffer extends AbstractBuffer { + + protected long[] backup; + + protected HashMap/*<aptr, buffer>*/ dataMap = new HashMap(); + + static { + NativeLibrary.ensureNativeLibLoaded(); + } + + protected AbstractLongBuffer(ByteBuffer bb, int elementSize) { + super(bb, elementSize); + + backup = new long[capacity]; + } + + final void updateBackup() { + for (int i = 0; i < capacity; i++) { + backup[i] = get(i); + } + } + + public final boolean hasArray() { + return true; + } + + public final long[] array() { + return backup; + } + + /** Absolute get method. Get the pointer value at the given index */ + public abstract long get(int idx); + + /** Relative get method. Get the pointer value at the current position and increment the position by one. */ + public final long get() { + long r = get(position); + position++; + return r; + } + + /** + * Relative bulk get method. Copy the pointer values <code> [ position .. position+length [</code> + * to the destination array <code> [ dest[offset] .. dest[offset+length] [ </code> + * and increment the position by <code>length</code>. */ + public final AbstractLongBuffer get(long[] dest, int offset, int length) { + if (dest.length<offset+length) { + throw new IndexOutOfBoundsException(); + } + if (remaining() < length) { + throw new IndexOutOfBoundsException(); + } + while(length>0) { + dest[offset++] = get(position++); + length--; + } + return this; + } + + /** Absolute put method. Put the pointer value at the given index */ + public abstract AbstractLongBuffer put(int index, long value); + + /** Relative put method. Put the pointer value at the current position and increment the position by one. */ + public final AbstractLongBuffer put(long value) { + put(position, value); + position++; + return this; + } + + /** + * Relative bulk put method. Put the pointer values <code> [ src[offset] .. src[offset+length] [</code> + * at the current position and increment the position by <code>length</code>. */ + public final AbstractLongBuffer put(long[] src, int offset, int length) { + if (src.length<offset+length) { + throw new IndexOutOfBoundsException(); + } + if (remaining() < length) { + throw new IndexOutOfBoundsException(); + } + while(length>0) { + put(position++, src[offset++]); + length--; + } + return this; + } + + /** + * Relative bulk get method. Copy the source values <code> src[position .. capacity] [</code> + * to this buffer and increment the position by <code>capacity-position</code>. */ + public AbstractLongBuffer put(AbstractLongBuffer src) { + if (remaining() < src.remaining()) { + throw new IndexOutOfBoundsException(); + } + while (src.hasRemaining()) { + put(src.get()); + } + return this; + } +} diff --git a/src/java/com/jogamp/gluegen/runtime/Int64Buffer.java b/src/java/com/jogamp/gluegen/runtime/Int64Buffer.java index 98d0834..4535bdb 100644 --- a/src/java/com/jogamp/gluegen/runtime/Int64Buffer.java +++ b/src/java/com/jogamp/gluegen/runtime/Int64Buffer.java @@ -37,15 +37,10 @@ import java.nio.ByteBuffer; * @author Michael Bien * @author Sven Gothel */ -public abstract class Int64Buffer { - - protected final ByteBuffer bb; - protected int capacity; - protected int position; - protected long[] backup; +public abstract class Int64Buffer extends AbstractLongBuffer { protected Int64Buffer(ByteBuffer bb) { - this.bb = bb; + super(bb, elementSize()); } public static Int64Buffer allocate(int size) { @@ -76,94 +71,12 @@ public abstract class Int64Buffer { } - void updateBackup() { - for (int i = 0; i < capacity; i++) { - backup[i] = get(i); - } - } - - int arrayOffset() { - return 0; - } - public static int elementSize() { return Buffers.SIZEOF_LONG; } - public int limit() { - return capacity; - } - - public int capacity() { - return capacity; - } - - public int position() { - return position; - } - - public Int64Buffer position(int newPos) { - if (0 > newPos || newPos >= capacity) { - throw new IndexOutOfBoundsException("Sorry to interrupt, but the position "+newPos+" was out of bounds. " + - "My capacity is "+capacity()+"."); - } - position = newPos; - return this; - } - - public int remaining() { - return capacity - position; - } - - public boolean hasRemaining() { - return position < capacity; - } - - public Int64Buffer rewind() { - position = 0; - return this; - } - - boolean hasArray() { - return true; - } - - public long[] array() { - return backup; - } - - public ByteBuffer getBuffer() { - return bb; - } - - public boolean isDirect() { - return bb.isDirect(); - } - - public long get() { - long r = get(position); - position++; - return r; - } - - public abstract long get(int idx); - - public abstract Int64Buffer put(int index, long value); - - public abstract Int64Buffer put(long value); - - public Int64Buffer put(Int64Buffer src) { - if (remaining() < src.remaining()) { - throw new IndexOutOfBoundsException(); - } - while (src.hasRemaining()) { - put(src.get()); - } - return this; - } - public String toString() { - return "Int64Buffer[capacity "+capacity+", position "+position+", elementSize "+elementSize()+", ByteBuffer.capacity "+bb.capacity()+"]"; + return "Int64Buffer:"+super.toString(); } } diff --git a/src/java/com/jogamp/gluegen/runtime/Int64BufferME_CDC_FP.java b/src/java/com/jogamp/gluegen/runtime/Int64BufferME_CDC_FP.java index cedb737..93863cf 100755 --- a/src/java/com/jogamp/gluegen/runtime/Int64BufferME_CDC_FP.java +++ b/src/java/com/jogamp/gluegen/runtime/Int64BufferME_CDC_FP.java @@ -55,7 +55,7 @@ final class Int64BufferME_CDC_FP extends Int64Buffer { backup = new long[capacity]; } - public long get(int idx) { + public final long get(int idx) { if (0 > idx || idx >= capacity) { throw new IndexOutOfBoundsException(); } @@ -68,7 +68,7 @@ final class Int64BufferME_CDC_FP extends Int64Buffer { return lo << 32 | hi; } - public Int64Buffer put(int idx, long v) { + public final AbstractLongBuffer put(int idx, long v) { if (0 > idx || idx >= capacity) { throw new IndexOutOfBoundsException(); } @@ -85,10 +85,4 @@ final class Int64BufferME_CDC_FP extends Int64Buffer { } return this; } - - public Int64Buffer put(long v) { - put(position, v); - position++; - return this; - } } diff --git a/src/java/com/jogamp/gluegen/runtime/Int64BufferSE.java b/src/java/com/jogamp/gluegen/runtime/Int64BufferSE.java index 166d0c6..a874133 100755 --- a/src/java/com/jogamp/gluegen/runtime/Int64BufferSE.java +++ b/src/java/com/jogamp/gluegen/runtime/Int64BufferSE.java @@ -49,21 +49,16 @@ final class Int64BufferSE extends Int64Buffer { super(bb); this.pb = bb.asLongBuffer(); - - capacity = bb.capacity() / elementSize(); - - position = 0; - backup = new long[capacity]; } - public long get(int idx) { + public final long get(int idx) { if (0 > idx || idx >= capacity) { throw new IndexOutOfBoundsException(); } return pb.get(idx); } - public Int64Buffer put(int idx, long v) { + public final AbstractLongBuffer put(int idx, long v) { if (0 > idx || idx >= capacity) { throw new IndexOutOfBoundsException(); } @@ -71,10 +66,4 @@ final class Int64BufferSE extends Int64Buffer { pb.put(idx, v); return this; } - - public Int64Buffer put(long v) { - put(position, v); - position++; - return this; - } } diff --git a/src/java/com/jogamp/gluegen/runtime/PointerBuffer.java b/src/java/com/jogamp/gluegen/runtime/PointerBuffer.java index 3ee7b54..cfc53a8 100644 --- a/src/java/com/jogamp/gluegen/runtime/PointerBuffer.java +++ b/src/java/com/jogamp/gluegen/runtime/PointerBuffer.java @@ -43,12 +43,7 @@ import java.util.HashMap; * @author Michael Bien * @author Sven Gothel */ -public abstract class PointerBuffer { - - protected final ByteBuffer bb; - protected int capacity; - protected int position; - protected long[] backup; +public abstract class PointerBuffer extends AbstractLongBuffer { protected HashMap/*<aptr, buffer>*/ dataMap = new HashMap(); @@ -57,7 +52,7 @@ public abstract class PointerBuffer { } protected PointerBuffer(ByteBuffer bb) { - this.bb = bb; + super(bb, elementSize()); } public static PointerBuffer allocate(int size) { @@ -88,88 +83,33 @@ public abstract class PointerBuffer { } - void updateBackup() { - for (int i = 0; i < capacity; i++) { - backup[i] = get(i); - } - } - - int arrayOffset() { - return 0; - } - public static int elementSize() { return Platform.is32Bit() ? Buffers.SIZEOF_INT : Buffers.SIZEOF_LONG; } - public int limit() { - return capacity; - } - - public int capacity() { - return capacity; - } - - public int position() { - return position; - } - - public PointerBuffer position(int newPos) { - if (0 > newPos || newPos >= capacity) { - throw new IndexOutOfBoundsException("Sorry to interrupt, but the position "+newPos+" was out of bounds. " + - "My capacity is "+capacity()+"."); + public final PointerBuffer put(PointerBuffer src) { + if (remaining() < src.remaining()) { + throw new IndexOutOfBoundsException(); + } + long addr; + while (src.hasRemaining()) { + addr = src.get(); + put(addr); + Long addrL = new Long(addr); + Buffer bb = (Buffer) dataMap.get(addrL); + if(null!=bb) { + dataMap.put(addrL, bb); + } else { + dataMap.remove(addrL); + } } - position = newPos; - return this; - } - - public int remaining() { - return capacity - position; - } - - public boolean hasRemaining() { - return position < capacity; - } - - public PointerBuffer rewind() { - position = 0; return this; } - boolean hasArray() { - return true; - } - - public long[] array() { - return backup; - } - - public ByteBuffer getBuffer() { - return bb; - } - - public boolean isDirect() { - return bb.isDirect(); - } - - public long get() { - long r = get(position); - position++; - return r; - } - - public abstract long get(int idx); - - /** put the pointer value at position index */ - public abstract PointerBuffer put(int index, long value); - - /** put the pointer value at the end */ - public abstract PointerBuffer put(long value); - /** Put the address of the given direct Buffer at the given position of this pointer array. Adding a reference of the given direct Buffer to this object. */ - public PointerBuffer referenceBuffer(int index, Buffer bb) { + public final PointerBuffer referenceBuffer(int index, Buffer bb) { if(null==bb) { throw new RuntimeException("Buffer is null"); } @@ -189,18 +129,18 @@ public abstract class PointerBuffer { /** Put the address of the given direct Buffer at the end of this pointer array. Adding a reference of the given direct Buffer to this object. */ - public PointerBuffer referenceBuffer(Buffer bb) { + public final PointerBuffer referenceBuffer(Buffer bb) { referenceBuffer(position, bb); position++; return this; } - public Buffer getReferencedBuffer(int index) { + public final Buffer getReferencedBuffer(int index) { long addr = get(index); return (Buffer) dataMap.get(new Long(addr)); } - public Buffer getReferencedBuffer() { + public final Buffer getReferencedBuffer() { Buffer bb = getReferencedBuffer(position); position++; return bb; @@ -208,18 +148,8 @@ public abstract class PointerBuffer { private native long getDirectBufferAddressImpl(Object directBuffer); - 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()+"]"; + return "PointerBuffer:"+super.toString(); } } diff --git a/src/java/com/jogamp/gluegen/runtime/PointerBufferME_CDC_FP.java b/src/java/com/jogamp/gluegen/runtime/PointerBufferME_CDC_FP.java index 1134ee7..a660e1f 100755 --- a/src/java/com/jogamp/gluegen/runtime/PointerBufferME_CDC_FP.java +++ b/src/java/com/jogamp/gluegen/runtime/PointerBufferME_CDC_FP.java @@ -48,14 +48,9 @@ final class PointerBufferME_CDC_FP extends PointerBuffer { PointerBufferME_CDC_FP(ByteBuffer bb) { super(bb); this.pb = bb.asIntBuffer(); - - capacity = bb.capacity() / elementSize(); - - position = 0; - backup = new long[capacity]; } - public long get(int idx) { + public final long get(int idx) { if (0 > idx || idx >= capacity) { throw new IndexOutOfBoundsException(); } @@ -72,7 +67,7 @@ final class PointerBufferME_CDC_FP extends PointerBuffer { } } - public PointerBuffer put(int idx, long v) { + public final AbstractLongBuffer put(int idx, long v) { if (0 > idx || idx >= capacity) { throw new IndexOutOfBoundsException(); } @@ -93,10 +88,4 @@ final class PointerBufferME_CDC_FP extends PointerBuffer { } return this; } - - public PointerBuffer put(long v) { - put(position, v); - position++; - return this; - } } diff --git a/src/java/com/jogamp/gluegen/runtime/PointerBufferSE.java b/src/java/com/jogamp/gluegen/runtime/PointerBufferSE.java index 6f131a9..9943ec1 100755 --- a/src/java/com/jogamp/gluegen/runtime/PointerBufferSE.java +++ b/src/java/com/jogamp/gluegen/runtime/PointerBufferSE.java @@ -53,14 +53,9 @@ final class PointerBufferSE extends PointerBuffer { } else { this.pb = bb.asLongBuffer(); } - - capacity = bb.capacity() / elementSize(); - - position = 0; - backup = new long[capacity]; } - public long get(int idx) { + public final long get(int idx) { if (0 > idx || idx >= capacity) { throw new IndexOutOfBoundsException(); } @@ -71,7 +66,7 @@ final class PointerBufferSE extends PointerBuffer { } } - public PointerBuffer put(int idx, long v) { + public final AbstractLongBuffer put(int idx, long v) { if (0 > idx || idx >= capacity) { throw new IndexOutOfBoundsException(); } @@ -84,9 +79,4 @@ final class PointerBufferSE extends PointerBuffer { return this; } - public PointerBuffer put(long v) { - put(position, v); - position++; - return this; - } } diff --git a/src/java/com/sun/gluegen/test/TestPointerBufferEndian.java b/src/java/com/sun/gluegen/test/TestPointerBufferEndian.java deleted file mode 100644 index 96e4e87..0000000 --- a/src/java/com/sun/gluegen/test/TestPointerBufferEndian.java +++ /dev/null @@ -1,41 +0,0 @@ - -package com.sun.gluegen.test; - -import com.jogamp.gluegen.runtime.*; -import java.nio.*; - -public class TestPointerBufferEndian { - public static void main (String[] args) { - boolean direct = args.length>0 && args[0].equals("-direct"); - boolean ok = true; - int bitsPtr = Platform.getPointerSizeInBits(); - String bitsProp = System.getProperty("sun.arch.data.model"); - String os = System.getProperty("os.name"); - String cpu = System.getProperty("os.arch"); - System.out.println("OS: <"+os+"> CPU: <"+cpu+"> Bits: <"+bitsPtr+"/"+bitsProp+">"); - System.out.println("CPU is: "+ (Platform.is32Bit()?"32":"64") + " bit"); - System.out.println("Buffer is in: "+ (Platform.isLittleEndian()?"little":"big") + " endian"); - PointerBuffer ptr = direct ? PointerBuffer.allocateDirect(3) : PointerBuffer.allocate(3); - ptr.put(0, 0x0123456789ABCDEFL); - ptr.put(1, 0x8877665544332211L); - ptr.put(2, 0xAFFEDEADBEEFAFFEL); - long v = ptr.get(0); - if( 0x0123456789ABCDEFL != v ) { - System.out.println("Err[0] shall 0x0123456789ABCDEF, is: "+Long.toHexString(v)); - ok=false; - } - v = ptr.get(1); - if( 0x8877665544332211L != v ) { - System.out.println("Err[1] shall 0x8877665544332211, is: "+Long.toHexString(v)); - ok=false; - } - v = ptr.get(2); - if( 0xAFFEDEADBEEFAFFEL != v ) { - System.out.println("Err[2] shall 0xAFFEDEADBEEFAFFE, is: "+Long.toHexString(v)); - ok=false; - } - if(!ok) { - throw new RuntimeException("Long conversion failure"); - } - } -} diff --git a/src/java/com/sun/gluegen/test/TestStructAccessorEndian.java b/src/java/com/sun/gluegen/test/TestStructAccessorEndian.java deleted file mode 100644 index 7202056..0000000 --- a/src/java/com/sun/gluegen/test/TestStructAccessorEndian.java +++ /dev/null @@ -1,41 +0,0 @@ - -package com.sun.gluegen.test; - -import com.jogamp.gluegen.runtime.*; -import java.nio.*; - -public class TestStructAccessorEndian { - public static void main (String args[]) { - boolean ok = true; - int bitsPtr = Platform.getPointerSizeInBits(); - String bitsProp = System.getProperty("sun.arch.data.model"); - String os = System.getProperty("os.name"); - String cpu = System.getProperty("os.arch"); - System.out.println("OS: <"+os+"> CPU: <"+cpu+"> Bits: <"+bitsPtr+"/"+bitsProp+">"); - System.out.println("CPU is: "+ (Platform.is32Bit()?"32":"64") + " bit"); - System.out.println("Buffer is in: "+ (Platform.isLittleEndian()?"little":"big") + " endian"); - ByteBuffer tst = Buffers.newDirectByteBuffer(Buffers.SIZEOF_LONG * 3); - StructAccessor acc = new StructAccessor(tst); - acc.setLongAt(0, 0x0123456789ABCDEFL); - acc.setLongAt(1, 0x8877665544332211L); - acc.setLongAt(2, 0xAFFEDEADBEEFAFFEL); - long v = acc.getLongAt(0); - if( 0x0123456789ABCDEFL != v ) { - System.out.println("Err[0] shall 0x0123456789ABCDEF, is: "+Long.toHexString(v)); - ok=false; - } - v = acc.getLongAt(1); - if( 0x8877665544332211L != v ) { - System.out.println("Err[1] shall 0x8877665544332211, is: "+Long.toHexString(v)); - ok=false; - } - v = acc.getLongAt(2); - if( 0xAFFEDEADBEEFAFFEL != v ) { - System.out.println("Err[2] shall 0xAFFEDEADBEEFAFFE, is: "+Long.toHexString(v)); - ok=false; - } - if(!ok) { - throw new RuntimeException("Long conversion failure"); - } - } -} |