From 0a8e1566c766f3b5a5e71b5d80500034f1a614a8 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 20 Jul 2011 07:30:48 +0200 Subject: Cleanup: Platform CPU enum, MachineDescription, Platform: - enum CPUFamily is part of CPUType - DALVIK -> ANDROID - ARM: ARM + ARMv[567] MachineDescription - self contained - static size/alignment Config (enum) for unix32, unix64, win32, win64 and armeabi - add 'long double' - Removed MachineDescription32Bit, MachineDescription64Bit - createStatic(..) uses OS/CPU to fetch best match if not at runtime FIXES: JavaEmitter's struct-emit: Proper 32/64 struct sizes TODO: StructAccessor's mapping to Buffer w/ index os sizeof() doesn't work, since offset may not be multiple of sizeof()! i.e. typedef struct { int8_t bits1; // +1 - 0 // +3 (p32) int32_t id; // +4 - 4 int8_t bits2; // +1 - 8 // +3 (p32) - int64_t long0; // +8 - 12 so "longBuffer.get()" is invalid, but "byteBuffer.getLong()" must be done. The actual impl. doesn't matter, hence dropping the other nio type mappings is good. --- src/native/common/MachineDescriptionRuntime.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/native/common/MachineDescriptionRuntime.c') diff --git a/src/native/common/MachineDescriptionRuntime.c b/src/native/common/MachineDescriptionRuntime.c index 0e6475c..a8a69ee 100644 --- a/src/native/common/MachineDescriptionRuntime.c +++ b/src/native/common/MachineDescriptionRuntime.c @@ -74,6 +74,11 @@ typedef struct { double v; } struct_alignment_double; +typedef struct { + int8_t c1; + long double v; +} struct_alignment_ldouble; + // size_t padding(size_t totalsize, size_t typesize) { return totalsize - typesize - sizeof(char); } // static size_t alignment(size_t totalsize, size_t typesize) { return totalsize - typesize; } #define ALIGNMENT(a, b) ( (a) - (b) ) @@ -123,6 +128,11 @@ Java_jogamp_common_os_MachineDescriptionRuntime_getAlignmentDoubleImpl(JNIEnv *e return ALIGNMENT(sizeof( struct_alignment_double ), sizeof(double)); } +JNIEXPORT jint JNICALL +Java_jogamp_common_os_MachineDescriptionRuntime_getAlignmentLongDoubleImpl(JNIEnv *env, jclass _unused) { + return ALIGNMENT(sizeof( struct_alignment_ldouble ), sizeof(long double)); +} + JNIEXPORT jint JNICALL Java_jogamp_common_os_MachineDescriptionRuntime_getSizeOfIntImpl(JNIEnv *env, jclass _unused) { return sizeof(int); @@ -143,3 +153,8 @@ Java_jogamp_common_os_MachineDescriptionRuntime_getSizeOfDoubleImpl(JNIEnv *env, return sizeof(double); } +JNIEXPORT jint JNICALL +Java_jogamp_common_os_MachineDescriptionRuntime_getSizeOfLongDoubleImpl(JNIEnv *env, jclass _unused) { + return sizeof(long double); +} + -- cgit v1.2.3