aboutsummaryrefslogtreecommitdiffstats
path: root/src/junit/com/jogamp/common/nio
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-07-17 16:34:39 +0200
committerSven Gothel <[email protected]>2011-07-17 16:34:39 +0200
commitf733203dfbd034a6b1aa3eb2cd616437c982c435 (patch)
tree4ace71d4b129870b02f962b714c9dce9f83bc294 /src/junit/com/jogamp/common/nio
parentad3dc39ccfddb007c3e91acf454f804573969419 (diff)
GlueGen proper size / alignment of primitive and compound types usage [1/2] - Preparation.
Currently GlueGen fails for type long (size) and some alignments (see package.html). - The size and alignment values shall be queried at runtime. - Compound alignment needs to follow the described natural alignment (also @runtime). - - Build - add Linux Arm7 (EABI) - junit test - added compound/struct tests, pointing out the shortcomings of current impl. - package.html - Added alignment documentation - remove intptr.cfg - add GluGen types int8_t, int16_t, uint8_t, uint16_t - move MachineDescription* into runtime - Platform - has runtime MachineDescription - moved size, .. to MachineDescription - use enums for OSType, CPUArch and CPUType defined by os.name/os.arch, triggering exception if os/arch is not supported. This avoids Java String comparison and conscious os/arch detection. - MachineDescription: - compile time instances MachineDescription32Bits, MachineDescription64Bits - runtime queried instance MachineDescriptionRuntime - correct size, alignment, page size, ..
Diffstat (limited to 'src/junit/com/jogamp/common/nio')
-rw-r--r--src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java10
-rw-r--r--src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java9
2 files changed, 8 insertions, 11 deletions
diff --git a/src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java b/src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java
index da232a2..e587acf 100644
--- a/src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java
+++ b/src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java
@@ -11,13 +11,11 @@ import static java.lang.System.*;
public class TestPointerBufferEndian {
protected void testImpl (boolean direct) {
- int bitsPtr = Platform.getPointerSizeInBits();
+ final MachineDescription machine = Platform.getMachineDescription();
+ int bitsPtr = machine.pointerSizeInBytes() * 8;
String bitsProp = System.getProperty("sun.arch.data.model");
- String os = System.getProperty("os.name");
- String cpu = System.getProperty("os.arch");
- out.println("OS: <"+os+"> CPU: <"+cpu+"> Bits: <"+bitsPtr+"/"+bitsProp+">");
- out.println("CPU is: "+ (Platform.is32Bit()?"32":"64") + " bit");
- out.println("Buffer is in: "+ (Platform.isLittleEndian()?"little":"big") + " endian");
+ out.println("OS: <"+Platform.OS+"> CPU: <"+Platform.ARCH+"> Bits: <"+bitsPtr+"/"+bitsProp+">");
+ out.println(machine.toString());
long[] valuesSource = { 0x0123456789ABCDEFL, 0x8877665544332211L, 0xAFFEDEADBEEFAFFEL };
long[] values32Bit = { 0x0000000089ABCDEFL, 0x0000000044332211L, 0x00000000BEEFAFFEL };
diff --git a/src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java b/src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java
index 09781ec..8a20272 100644
--- a/src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java
+++ b/src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java
@@ -14,13 +14,12 @@ public class TestStructAccessorEndian {
@Test
public void testStructAccessorEndian1 () {
- int bitsPtr = Platform.getPointerSizeInBits();
+ final MachineDescription machine = Platform.getMachineDescription();
+ int bitsPtr = machine.pointerSizeInBytes() * 8;
String bitsProp = System.getProperty("sun.arch.data.model");
- String os = System.getProperty("os.name");
- String cpu = System.getProperty("os.arch");
- out.println("OS: <"+os+"> CPU: <"+cpu+"> Bits: <"+bitsPtr+"/"+bitsProp+">");
+ out.println("OS: <"+Platform.OS+"> CPU: <"+Platform.ARCH+"> Bits: <"+bitsPtr+"/"+bitsProp+">");
out.println("CPU is: "+ (Platform.is32Bit()?"32":"64") + " bit");
- out.println("Buffer is in: "+ (Platform.isLittleEndian()?"little":"big") + " endian");
+ out.println(machine.toString());
long[] valuesSource = { 0x0123456789ABCDEFL, 0x8877665544332211L, 0xAFFEDEADBEEFAFFEL };
ByteBuffer tst = Buffers.newDirectByteBuffer(Buffers.SIZEOF_LONG * valuesSource.length);