diff options
author | sg215889 <[email protected]> | 2009-07-28 18:57:07 -0700 |
---|---|---|
committer | sg215889 <[email protected]> | 2009-07-28 18:57:07 -0700 |
commit | abea54842158e588112f6e35d1ba3c5f069dfc29 (patch) | |
tree | 6e311b8d655a0e04d3ad1c90cb06a67256863aaf /src/java/com/sun/gluegen/test | |
parent | f607cdf272dffbd45e6389c5715a9596e85c2a90 (diff) |
Fix: Native CPU 32/64 bit detection; Tested on CVM/J2SE
Diffstat (limited to 'src/java/com/sun/gluegen/test')
-rw-r--r-- | src/java/com/sun/gluegen/test/TestPointerBufferEndian.java | 5 | ||||
-rw-r--r-- | src/java/com/sun/gluegen/test/TestStructAccessorEndian.java | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/java/com/sun/gluegen/test/TestPointerBufferEndian.java b/src/java/com/sun/gluegen/test/TestPointerBufferEndian.java index cd375af..ba77eed 100644 --- a/src/java/com/sun/gluegen/test/TestPointerBufferEndian.java +++ b/src/java/com/sun/gluegen/test/TestPointerBufferEndian.java @@ -8,10 +8,11 @@ public class TestPointerBufferEndian { public static void main (String[] args) { boolean direct = args.length>0 && args[0].equals("-direct"); boolean ok = true; - String bits = System.getProperty("sun.arch.data.model"); + int bitsPtr = CPU.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: <"+bits+">"); + System.out.println("OS: <"+os+"> CPU: <"+cpu+"> Bits: <"+bitsPtr+"/"+bitsProp+">"); System.out.println("CPU is: "+ (CPU.is32Bit()?"32":"64") + " bit"); System.out.println("Buffer is in: "+ (BufferFactory.isLittleEndian()?"little":"big") + " endian"); PointerBuffer ptr = direct ? PointerBuffer.allocateDirect(3) : PointerBuffer.allocate(3); diff --git a/src/java/com/sun/gluegen/test/TestStructAccessorEndian.java b/src/java/com/sun/gluegen/test/TestStructAccessorEndian.java index fa28cb6..dc53a10 100644 --- a/src/java/com/sun/gluegen/test/TestStructAccessorEndian.java +++ b/src/java/com/sun/gluegen/test/TestStructAccessorEndian.java @@ -7,10 +7,11 @@ import java.nio.*; public class TestStructAccessorEndian { public static void main (String args[]) { boolean ok = true; - String bits = System.getProperty("sun.arch.data.model"); + int bitsPtr = CPU.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: <"+bits+">"); + System.out.println("OS: <"+os+"> CPU: <"+cpu+"> Bits: <"+bitsPtr+"/"+bitsProp+">"); System.out.println("CPU is: "+ (CPU.is32Bit()?"32":"64") + " bit"); System.out.println("Buffer is in: "+ (BufferFactory.isLittleEndian()?"little":"big") + " endian"); ByteBuffer tst = BufferFactory.newDirectByteBuffer(BufferFactory.SIZEOF_LONG * 3); |