From f733203dfbd034a6b1aa3eb2cd616437c982c435 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 17 Jul 2011 16:34:39 +0200 Subject: 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, .. --- src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java') 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 }; -- cgit v1.2.3