diff options
author | Sven Gothel <[email protected]> | 2011-07-17 19:55:36 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-07-17 19:55:36 +0200 |
commit | 8fc841257cae6b49399b29dfa53e3e834d27cabb (patch) | |
tree | 5012bb4ec63378017479d51e65262974a545645e | |
parent | 2bf03e9814477b412f9533d3ba3f4c597892501e (diff) |
GlueGen: Alignment Cleanup ..
- SizeThunk
- rename: compute -> computeSize
- add: computeAlignment
- merge types: char -> int8, short -> int16
- 'int' and 'long' may differ
-
9 files changed, 133 insertions, 133 deletions
diff --git a/src/java/com/jogamp/common/os/MachineDescription.java b/src/java/com/jogamp/common/os/MachineDescription.java index a407187..99383b4 100644 --- a/src/java/com/jogamp/common/os/MachineDescription.java +++ b/src/java/com/jogamp/common/os/MachineDescription.java @@ -55,8 +55,6 @@ public class MachineDescription { final private int int32SizeInBytes = 4; final private int int64SizeInBytes = 8; - final private int charSizeInBytes; - final private int shortSizeInBytes; final private int intSizeInBytes; final private int longSizeInBytes; final private int floatSizeInBytes; @@ -69,8 +67,6 @@ public class MachineDescription { final private int int16AlignmentInBytes; final private int int32AlignmentInBytes; final private int int64AlignmentInBytes; - final private int charAlignmentInBytes; - final private int shortAlignmentInBytes; final private int intAlignmentInBytes; final private int longAlignmentInBytes; final private int floatAlignmentInBytes; @@ -81,8 +77,6 @@ public class MachineDescription { boolean littleEndian, - int charSizeInBytes, - int shortSizeInBytes, int intSizeInBytes, int longSizeInBytes, int floatSizeInBytes, @@ -94,8 +88,6 @@ public class MachineDescription { int int16AlignmentInBytes, int int32AlignmentInBytes, int int64AlignmentInBytes, - int charAlignmentInBytes, - int shortAlignmentInBytes, int intAlignmentInBytes, int longAlignmentInBytes, int floatAlignmentInBytes, @@ -105,8 +97,6 @@ public class MachineDescription { this.littleEndian = littleEndian; - this.charSizeInBytes = charSizeInBytes; - this.shortSizeInBytes = shortSizeInBytes; this.intSizeInBytes = intSizeInBytes; this.longSizeInBytes = longSizeInBytes; this.floatSizeInBytes = floatSizeInBytes; @@ -119,8 +109,6 @@ public class MachineDescription { this.int16AlignmentInBytes = int16AlignmentInBytes; this.int32AlignmentInBytes = int32AlignmentInBytes; this.int64AlignmentInBytes = int64AlignmentInBytes; - this.charAlignmentInBytes = charAlignmentInBytes; - this.shortAlignmentInBytes = shortAlignmentInBytes; this.intAlignmentInBytes = intAlignmentInBytes; this.longAlignmentInBytes = longAlignmentInBytes; this.floatAlignmentInBytes = floatAlignmentInBytes; @@ -156,8 +144,6 @@ public class MachineDescription { return !is32Bit; } - public final int charSizeInBytes() { return charSizeInBytes; } - public final int shortSizeInBytes() { return shortSizeInBytes; } public final int intSizeInBytes() { return intSizeInBytes; } public final int longSizeInBytes() { return longSizeInBytes; } public final int int8SizeInBytes() { return int8SizeInBytes; } @@ -169,8 +155,6 @@ public class MachineDescription { public final int pointerSizeInBytes() { return pointerSizeInBytes; } public final int pageSizeInBytes() { return pageSizeInBytes; } - public final int charAlignmentInBytes() { return charAlignmentInBytes; } - public final int shortAlignmentInBytes() { return shortAlignmentInBytes; } public final int intAlignmentInBytes() { return intAlignmentInBytes; } public final int longAlignmentInBytes() { return longAlignmentInBytes; } public final int int8AlignmentInBytes() { return int8AlignmentInBytes; } @@ -200,17 +184,15 @@ public class MachineDescription { sb = new StringBuilder(); } sb.append("MachineDescription: runtimeValidated ").append(isRuntimeValidated()).append(", littleEndian ").append(isLittleEndian()).append(", 32Bit ").append(is32Bit()).append(", primitive size / alignment:").append(Platform.getNewline()); - sb.append(" char ").append(charSizeInBytes) .append(" / ").append(charAlignmentInBytes); - sb.append(", short ").append(shortSizeInBytes) .append(" / ").append(shortAlignmentInBytes); - sb.append(", int ").append(intSizeInBytes) .append(" / ").append(intAlignmentInBytes); - sb.append(", long ").append(longSizeInBytes) .append(" / ").append(longAlignmentInBytes).append(Platform.getNewline()); sb.append(" int8 ").append(int8SizeInBytes) .append(" / ").append(int8AlignmentInBytes); - sb.append(", int16 ").append(int16SizeInBytes) .append(" / ").append(int16AlignmentInBytes); - sb.append(", int32 ").append(int32SizeInBytes) .append(" / ").append(int32AlignmentInBytes); + sb.append(", int16 ").append(int16SizeInBytes) .append(" / ").append(int16AlignmentInBytes).append(Platform.getNewline()); + sb.append(" int ").append(intSizeInBytes) .append(" / ").append(intAlignmentInBytes); + sb.append(", long ").append(longSizeInBytes) .append(" / ").append(longAlignmentInBytes).append(Platform.getNewline()); + sb.append(" int32 ").append(int32SizeInBytes) .append(" / ").append(int32AlignmentInBytes); sb.append(", int64 ").append(int64SizeInBytes) .append(" / ").append(int64AlignmentInBytes).append(Platform.getNewline()); sb.append(" float ").append(floatSizeInBytes) .append(" / ").append(floatAlignmentInBytes); - sb.append(", double ").append(doubleSizeInBytes) .append(" / ").append(doubleAlignmentInBytes); - sb.append(", pointer ").append(pointerSizeInBytes).append(" / ").append(pointerAlignmentInBytes); + sb.append(", double ").append(doubleSizeInBytes) .append(" / ").append(doubleAlignmentInBytes).append(Platform.getNewline()); + sb.append(" pointer ").append(pointerSizeInBytes).append(" / ").append(pointerAlignmentInBytes); sb.append(", page ").append(pageSizeInBytes); return sb; } diff --git a/src/java/com/jogamp/gluegen/cgram/HeaderParser.g b/src/java/com/jogamp/gluegen/cgram/HeaderParser.g index 79f966f..8c2ad26 100644 --- a/src/java/com/jogamp/gluegen/cgram/HeaderParser.g +++ b/src/java/com/jogamp/gluegen/cgram/HeaderParser.g @@ -334,7 +334,7 @@ options { // entry the enum should expand to e.g. int64. However, using // "long" here (which is what used to be the case) was // definitely incorrect and caused problems. - enumType = new EnumType(enumTypeName, SizeThunk.INT); + enumType = new EnumType(enumTypeName, SizeThunk.INT32); } return enumType; @@ -464,7 +464,7 @@ declSpecifiers returns [TypeBox tb] { { if (t == null && (x & (SIGNED | UNSIGNED)) != 0) { - t = new IntType("int", SizeThunk.INT, ((x & UNSIGNED) != 0), attrs2CVAttrs(x)); + t = new IntType("int", SizeThunk.INTxx, ((x & UNSIGNED) != 0), attrs2CVAttrs(x)); } tb = new TypeBox(t, ((x & TYPEDEF) != 0)); } @@ -498,9 +498,9 @@ typeSpecifier[int attributes] returns [Type t] { boolean unsigned = ((attributes & UNSIGNED) != 0); } : "void" { t = new VoidType(cvAttrs); } - | "char" { t = new IntType("char" , SizeThunk.CHAR, unsigned, cvAttrs); } - | "short" { t = new IntType("short", SizeThunk.SHORT, unsigned, cvAttrs); } - | "int" { t = new IntType("int" , SizeThunk.INT, unsigned, cvAttrs); } + | "char" { t = new IntType("char" , SizeThunk.INT8, unsigned, cvAttrs); } + | "short" { t = new IntType("short", SizeThunk.INT16, unsigned, cvAttrs); } + | "int" { t = new IntType("int" , SizeThunk.INTxx, unsigned, cvAttrs); } | "long" { t = new IntType("long" , SizeThunk.LONG, unsigned, cvAttrs); } | "float" { t = new FloatType("float", SizeThunk.FLOAT, cvAttrs); } | "double" { t = new DoubleType("double", SizeThunk.DOUBLE, cvAttrs); } @@ -593,7 +593,7 @@ specifierQualifierList returns [Type t] { )+ { if (t == null && (x & (SIGNED | UNSIGNED)) != 0) { - t = new IntType("int", SizeThunk.INT, ((x & UNSIGNED) != 0), attrs2CVAttrs(x)); + t = new IntType("int", SizeThunk.INTxx, ((x & UNSIGNED) != 0), attrs2CVAttrs(x)); } } ; diff --git a/src/java/com/jogamp/gluegen/cgram/types/Field.java b/src/java/com/jogamp/gluegen/cgram/types/Field.java index 2479e3d..891bb27 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/Field.java +++ b/src/java/com/jogamp/gluegen/cgram/types/Field.java @@ -84,7 +84,7 @@ public class Field { /** Offset, in bytes, of this field in the containing data structure given the specified MachineDescription. */ - public long getOffset(MachineDescription machDesc) { return offset.compute(machDesc); } + public long getOffset(MachineDescription machDesc) { return offset.computeSize(machDesc); } /** Sets the offset of this field in the containing data structure. */ public void setOffset(SizeThunk offset) { this.offset = offset; } diff --git a/src/java/com/jogamp/gluegen/cgram/types/SizeThunk.java b/src/java/com/jogamp/gluegen/cgram/types/SizeThunk.java index 1584a13..d71445d 100755 --- a/src/java/com/jogamp/gluegen/cgram/types/SizeThunk.java +++ b/src/java/com/jogamp/gluegen/cgram/types/SizeThunk.java @@ -60,72 +60,88 @@ public abstract class SizeThunk implements Cloneable { } } - public abstract long compute(MachineDescription machDesc); + public abstract long computeSize(MachineDescription machDesc); + public abstract long computeAlignment(MachineDescription machDesc); - public static final SizeThunk CHAR = new SizeThunk() { - public long compute(MachineDescription machDesc) { - return machDesc.charSizeInBytes(); + public static final SizeThunk INT8 = new SizeThunk() { + public long computeSize(MachineDescription machDesc) { + return machDesc.int8SizeInBytes(); } - }; - - public static final SizeThunk SHORT = new SizeThunk() { - public long compute(MachineDescription machDesc) { - return machDesc.shortSizeInBytes(); + public long computeAlignment(MachineDescription machDesc) { + return machDesc.int8AlignmentInBytes(); } }; - public static final SizeThunk INT = new SizeThunk() { - public long compute(MachineDescription machDesc) { - return machDesc.intSizeInBytes(); + public static final SizeThunk INT16 = new SizeThunk() { + public long computeSize(MachineDescription machDesc) { + return machDesc.int16SizeInBytes(); } - }; - - public static final SizeThunk LONG = new SizeThunk() { - public long compute(MachineDescription machDesc) { - return machDesc.longSizeInBytes(); + public long computeAlignment(MachineDescription machDesc) { + return machDesc.int16AlignmentInBytes(); } }; - public static final SizeThunk INT8 = new SizeThunk() { - public long compute(MachineDescription machDesc) { - return machDesc.int8SizeInBytes(); + public static final SizeThunk INT32 = new SizeThunk() { + public long computeSize(MachineDescription machDesc) { + return machDesc.int32SizeInBytes(); + } + public long computeAlignment(MachineDescription machDesc) { + return machDesc.int32AlignmentInBytes(); } }; - public static final SizeThunk INT16 = new SizeThunk() { - public long compute(MachineDescription machDesc) { - return machDesc.int16SizeInBytes(); + public static final SizeThunk INTxx = new SizeThunk() { + public long computeSize(MachineDescription machDesc) { + return machDesc.intSizeInBytes(); + } + public long computeAlignment(MachineDescription machDesc) { + return machDesc.intAlignmentInBytes(); } }; - public static final SizeThunk INT32 = new SizeThunk() { - public long compute(MachineDescription machDesc) { - return machDesc.int32SizeInBytes(); + public static final SizeThunk LONG = new SizeThunk() { + public long computeSize(MachineDescription machDesc) { + return machDesc.longSizeInBytes(); + } + public long computeAlignment(MachineDescription machDesc) { + return machDesc.longAlignmentInBytes(); } }; public static final SizeThunk INT64 = new SizeThunk() { - public long compute(MachineDescription machDesc) { + public long computeSize(MachineDescription machDesc) { return machDesc.int64SizeInBytes(); } + public long computeAlignment(MachineDescription machDesc) { + return machDesc.int64AlignmentInBytes(); + } }; public static final SizeThunk FLOAT = new SizeThunk() { - public long compute(MachineDescription machDesc) { + public long computeSize(MachineDescription machDesc) { return machDesc.floatSizeInBytes(); } + public long computeAlignment(MachineDescription machDesc) { + return machDesc.floatAlignmentInBytes(); + } }; public static final SizeThunk DOUBLE = new SizeThunk() { - public long compute(MachineDescription machDesc) { + public long computeSize(MachineDescription machDesc) { return machDesc.doubleSizeInBytes(); } + public long computeAlignment(MachineDescription machDesc) { + return machDesc.doubleAlignmentInBytes(); + } }; public static final SizeThunk POINTER = new SizeThunk() { - public long compute(MachineDescription machDesc) { + public long computeSize(MachineDescription machDesc) { return machDesc.pointerSizeInBytes(); } + public long computeAlignment(MachineDescription machDesc) { + return machDesc.pointerAlignmentInBytes(); + } }; // Factory methods for performing certain limited kinds of @@ -133,8 +149,13 @@ public abstract class SizeThunk implements Cloneable { public static SizeThunk add(final SizeThunk thunk1, final SizeThunk thunk2) { return new SizeThunk() { - public long compute(MachineDescription machDesc) { - return thunk1.compute(machDesc) + thunk2.compute(machDesc); + public long computeSize(MachineDescription machDesc) { + return thunk1.computeSize(machDesc) + thunk2.computeSize(machDesc); + } + public long computeAlignment(MachineDescription machDesc) { + final long thunk1A = thunk1.computeAlignment(machDesc); + final long thunk2A = thunk2.computeAlignment(machDesc); + return ( thunk1A > thunk2A ) ? thunk1A : thunk2A ; } }; } @@ -142,8 +163,14 @@ public abstract class SizeThunk implements Cloneable { public static SizeThunk sub(final SizeThunk thunk1, final SizeThunk thunk2) { return new SizeThunk() { - public long compute(MachineDescription machDesc) { - return thunk1.compute(machDesc) - thunk2.compute(machDesc); + public long computeSize(MachineDescription machDesc) { + return thunk1.computeSize(machDesc) - thunk2.computeSize(machDesc); + } + public long computeAlignment(MachineDescription machDesc) { + // FIXME + final long thunk1A = thunk1.computeAlignment(machDesc); + final long thunk2A = thunk2.computeAlignment(machDesc); + return ( thunk1A > thunk2A ) ? thunk1A : thunk2A ; } }; } @@ -151,8 +178,13 @@ public abstract class SizeThunk implements Cloneable { public static SizeThunk mul(final SizeThunk thunk1, final SizeThunk thunk2) { return new SizeThunk() { - public long compute(MachineDescription machDesc) { - return thunk1.compute(machDesc) * thunk2.compute(machDesc); + public long computeSize(MachineDescription machDesc) { + return thunk1.computeSize(machDesc) * thunk2.computeSize(machDesc); + } + public long computeAlignment(MachineDescription machDesc) { + final long thunk1A = thunk1.computeAlignment(machDesc); + final long thunk2A = thunk2.computeAlignment(machDesc); + return ( thunk1A > thunk2A ) ? thunk1A : thunk2A ; } }; } @@ -160,8 +192,14 @@ public abstract class SizeThunk implements Cloneable { public static SizeThunk mod(final SizeThunk thunk1, final SizeThunk thunk2) { return new SizeThunk() { - public long compute(MachineDescription machDesc) { - return thunk1.compute(machDesc) % thunk2.compute(machDesc); + public long computeSize(MachineDescription machDesc) { + return thunk1.computeSize(machDesc) % thunk2.computeSize(machDesc); + } + public long computeAlignment(MachineDescription machDesc) { + // FIXME + final long thunk1A = thunk1.computeAlignment(machDesc); + final long thunk2A = thunk2.computeAlignment(machDesc); + return ( thunk1A > thunk2A ) ? thunk1A : thunk2A ; } }; } @@ -169,32 +207,45 @@ public abstract class SizeThunk implements Cloneable { public static SizeThunk roundUp(final SizeThunk thunk1, final SizeThunk thunk2) { return new SizeThunk() { - public long compute(MachineDescription machDesc) { - long sz1 = thunk1.compute(machDesc); - long sz2 = thunk2.compute(machDesc); - long rem = (sz1 % sz2); + public long computeSize(MachineDescription machDesc) { + final long sz1 = thunk1.computeSize(machDesc); + final long sz2 = thunk2.computeSize(machDesc); + final long rem = (sz1 % sz2); if (rem == 0) { return sz1; } return sz1 + (sz2 - rem); } + public long computeAlignment(MachineDescription machDesc) { + final long thunk1A = thunk1.computeAlignment(machDesc); + final long thunk2A = thunk2.computeAlignment(machDesc); + return ( thunk1A > thunk2A ) ? thunk1A : thunk2A ; + } }; } public static SizeThunk max(final SizeThunk thunk1, final SizeThunk thunk2) { return new SizeThunk() { - public long compute(MachineDescription machDesc) { - return Math.max(thunk1.compute(machDesc), thunk2.compute(machDesc)); + public long computeSize(MachineDescription machDesc) { + return Math.max(thunk1.computeSize(machDesc), thunk2.computeSize(machDesc)); + } + public long computeAlignment(MachineDescription machDesc) { + final long thunk1A = thunk1.computeAlignment(machDesc); + final long thunk2A = thunk2.computeAlignment(machDesc); + return ( thunk1A > thunk2A ) ? thunk1A : thunk2A ; } }; } public static SizeThunk constant(final int constant) { return new SizeThunk() { - public long compute(MachineDescription machDesc) { + public long computeSize(MachineDescription machDesc) { return constant; } + public long computeAlignment(MachineDescription machDesc) { + return 1; // no real alignment for constants + } }; } } diff --git a/src/java/com/jogamp/gluegen/cgram/types/Type.java b/src/java/com/jogamp/gluegen/cgram/types/Type.java index 95afc2c..27aff92 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/Type.java +++ b/src/java/com/jogamp/gluegen/cgram/types/Type.java @@ -107,7 +107,7 @@ public abstract class Type implements Cloneable { if (thunk == null) { throw new RuntimeException("No size set for type \"" + getName() + "\""); } - return thunk.compute(machDesc); + return thunk.computeSize(machDesc); } /** Set the size of this type; only available for CompoundTypes. */ void setSize(SizeThunk size) { this.size = size; } diff --git a/src/java/jogamp/common/os/MachineDescription32Bit.java b/src/java/jogamp/common/os/MachineDescription32Bit.java index ec2bb4c..aebac80 100644 --- a/src/java/jogamp/common/os/MachineDescription32Bit.java +++ b/src/java/jogamp/common/os/MachineDescription32Bit.java @@ -51,11 +51,11 @@ import com.jogamp.common.os.MachineDescription; */ public class MachineDescription32Bit extends MachineDescription { public MachineDescription32Bit() { - // size: char, short, int, long, float, double, pointer, pageSize - // alignment: int8, int16, int32, int64, char, short, int, long, float, double, pointer + // size: int, long, float, double, pointer, pageSize + // alignment: int8, int16, int32, int64, int, long, float, double, pointer super( false /* runtime validated */, true /* little endian */, - /* size */ 1, 2, 4, 4, 4, 8, 4, 4096, - /*align */ 1, 2, 4, 8, 1, 2, 4, 4, 4, 8, 4); + /* size */ 4, 4, 4, 8, 4, 4096, + /*align */ 1, 2, 4, 8, 4, 4, 4, 8, 4); } } diff --git a/src/java/jogamp/common/os/MachineDescription64Bit.java b/src/java/jogamp/common/os/MachineDescription64Bit.java index 254ba30..4b3b13f 100644 --- a/src/java/jogamp/common/os/MachineDescription64Bit.java +++ b/src/java/jogamp/common/os/MachineDescription64Bit.java @@ -52,10 +52,10 @@ import com.jogamp.common.os.MachineDescription; */ public class MachineDescription64Bit extends MachineDescription { public MachineDescription64Bit() { - // size: char, short, int, long, float, double, pointer, pageSize - // alignment: int8, int16, int32, int64, char, short, int, long, float, double, pointer + // size: int, long, float, double, pointer, pageSize + // alignment: int8, int16, int32, int64, int, long, float, double, pointer super( false /* runtime validated */, true /* little endian */, - /* size */ 1, 2, 4, 8 /* on win, long is 4 !!! */, 4, 8, 8, 4096, - /*align */ 1, 2, 4, 8, 1, 2, 4, 8, 4, 8, 8); + /* size */ 4, 8 /* on win, long is 4 !!! */, 4, 8, 8, 4096, + /*align */ 1, 2, 4, 8, 4, 8, 4, 8, 8); } } diff --git a/src/java/jogamp/common/os/MachineDescriptionRuntime.java b/src/java/jogamp/common/os/MachineDescriptionRuntime.java index f904151..5d4a8c3 100644 --- a/src/java/jogamp/common/os/MachineDescriptionRuntime.java +++ b/src/java/jogamp/common/os/MachineDescriptionRuntime.java @@ -75,16 +75,16 @@ public class MachineDescriptionRuntime { } private static MachineDescription getMachineDescriptionImpl(int pointerSize, int pageSize) { - // size: char, short, int, long, float, double, pointer - // alignment: int8, int16, int32, int64, char, short, int, long, float, double, pointer + // size: int, long, float, double, pointer, pageSize + // alignment: int8, int16, int32, int64, int, long, float, double, pointer return new MachineDescription( true /* runtime validated */, isLittleEndianImpl(), - getSizeOfCharImpl(), getSizeOfShortImpl(), getSizeOfIntImpl(), getSizeOfLongImpl(), + getSizeOfIntImpl(), getSizeOfLongImpl(), getSizeOfFloatImpl(), getSizeOfDoubleImpl(), pointerSize, pageSize, getAlignmentInt8Impl(), getAlignmentInt16Impl(), getAlignmentInt32Impl(), getAlignmentInt64Impl(), - getAlignmentCharImpl(), getAlignmentShortImpl(), getAlignmentIntImpl(), getAlignmentLongImpl(), + getAlignmentIntImpl(), getAlignmentLongImpl(), getAlignmentFloatImpl(), getAlignmentDoubleImpl(), getAlignmentPointerImpl()); } private static boolean isLittleEndianImpl() { @@ -102,15 +102,11 @@ public class MachineDescriptionRuntime { private static native int getAlignmentInt16Impl(); private static native int getAlignmentInt32Impl(); private static native int getAlignmentInt64Impl(); - private static native int getAlignmentCharImpl(); - private static native int getAlignmentShortImpl(); private static native int getAlignmentIntImpl(); private static native int getAlignmentLongImpl(); private static native int getAlignmentPointerImpl(); private static native int getAlignmentFloatImpl(); private static native int getAlignmentDoubleImpl(); - private static native int getSizeOfCharImpl(); - private static native int getSizeOfShortImpl(); private static native int getSizeOfIntImpl(); private static native int getSizeOfLongImpl(); private static native int getSizeOfPointerImpl(); diff --git a/src/native/common/MachineDescriptionRuntime.c b/src/native/common/MachineDescriptionRuntime.c index 4cd6088..0e6475c 100644 --- a/src/native/common/MachineDescriptionRuntime.c +++ b/src/native/common/MachineDescriptionRuntime.c @@ -51,16 +51,6 @@ typedef struct { typedef struct { int8_t c1; - char v; -} struct_alignment_char; - -typedef struct { - int8_t c1; - short v; -} struct_alignment_short; - -typedef struct { - int8_t c1; int v; } struct_alignment_int; @@ -85,71 +75,52 @@ typedef struct { } struct_alignment_double; // 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; } +// static size_t alignment(size_t totalsize, size_t typesize) { return totalsize - typesize; } +#define ALIGNMENT(a, b) ( (a) - (b) ) JNIEXPORT jint JNICALL Java_jogamp_common_os_MachineDescriptionRuntime_getAlignmentInt8Impl(JNIEnv *env, jclass _unused) { - return alignment(sizeof( struct_alignment_int8 ), sizeof(int8_t)); + return ALIGNMENT(sizeof( struct_alignment_int8 ), sizeof(int8_t)); } JNIEXPORT jint JNICALL Java_jogamp_common_os_MachineDescriptionRuntime_getAlignmentInt16Impl(JNIEnv *env, jclass _unused) { - return alignment(sizeof( struct_alignment_int16 ), sizeof(int16_t)); + return ALIGNMENT(sizeof( struct_alignment_int16 ), sizeof(int16_t)); } JNIEXPORT jint JNICALL Java_jogamp_common_os_MachineDescriptionRuntime_getAlignmentInt32Impl(JNIEnv *env, jclass _unused) { - return alignment(sizeof( struct_alignment_int32 ), sizeof(int32_t)); + return ALIGNMENT(sizeof( struct_alignment_int32 ), sizeof(int32_t)); } JNIEXPORT jint JNICALL Java_jogamp_common_os_MachineDescriptionRuntime_getAlignmentInt64Impl(JNIEnv *env, jclass _unused) { - return alignment(sizeof( struct_alignment_int64 ), sizeof(int64_t)); -} - -JNIEXPORT jint JNICALL -Java_jogamp_common_os_MachineDescriptionRuntime_getAlignmentCharImpl(JNIEnv *env, jclass _unused) { - return alignment(sizeof( struct_alignment_char ), sizeof(char)); -} - -JNIEXPORT jint JNICALL -Java_jogamp_common_os_MachineDescriptionRuntime_getAlignmentShortImpl(JNIEnv *env, jclass _unused) { - return alignment(sizeof( struct_alignment_short ), sizeof(short)); + return ALIGNMENT(sizeof( struct_alignment_int64 ), sizeof(int64_t)); } JNIEXPORT jint JNICALL Java_jogamp_common_os_MachineDescriptionRuntime_getAlignmentIntImpl(JNIEnv *env, jclass _unused) { - return alignment(sizeof( struct_alignment_int ), sizeof(int)); + return ALIGNMENT(sizeof( struct_alignment_int ), sizeof(int)); } JNIEXPORT jint JNICALL Java_jogamp_common_os_MachineDescriptionRuntime_getAlignmentLongImpl(JNIEnv *env, jclass _unused) { - return alignment(sizeof( struct_alignment_long ), sizeof(long)); + return ALIGNMENT(sizeof( struct_alignment_long ), sizeof(long)); } JNIEXPORT jint JNICALL Java_jogamp_common_os_MachineDescriptionRuntime_getAlignmentPointerImpl(JNIEnv *env, jclass _unused) { - return alignment(sizeof( struct_alignment_pointer ), sizeof(void *)); + return ALIGNMENT(sizeof( struct_alignment_pointer ), sizeof(void *)); } JNIEXPORT jint JNICALL Java_jogamp_common_os_MachineDescriptionRuntime_getAlignmentFloatImpl(JNIEnv *env, jclass _unused) { - return alignment(sizeof( struct_alignment_float ), sizeof(float)); + return ALIGNMENT(sizeof( struct_alignment_float ), sizeof(float)); } JNIEXPORT jint JNICALL Java_jogamp_common_os_MachineDescriptionRuntime_getAlignmentDoubleImpl(JNIEnv *env, jclass _unused) { - return alignment(sizeof( struct_alignment_double ), sizeof(double)); -} - -JNIEXPORT jint JNICALL -Java_jogamp_common_os_MachineDescriptionRuntime_getSizeOfCharImpl(JNIEnv *env, jclass _unused) { - return sizeof(char); -} - -JNIEXPORT jint JNICALL -Java_jogamp_common_os_MachineDescriptionRuntime_getSizeOfShortImpl(JNIEnv *env, jclass _unused) { - return sizeof(short); + return ALIGNMENT(sizeof( struct_alignment_double ), sizeof(double)); } JNIEXPORT jint JNICALL |