diff options
author | Sven Gothel <[email protected]> | 2012-12-30 19:56:25 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-12-30 19:56:25 +0100 |
commit | 0104f0ff35304b0aa416c2caa7b53aadf592f36a (patch) | |
tree | 8c30a373b2ff6b17cdb5f39464b5f9305ec9071c /src | |
parent | 0b43b43f889ad7fc220942b0076e2001ca3cf13f (diff) |
Fix Bug625: StructAccessor missing setShortsAt() and getShortsAt() methods for short[]
For short[] Java code gets emitted for an StructAccessor object that uses:
void setShortsAt(int i, short[] shorts)
short[] getShortsAt(int i, short[] shorts)
Problem was that StructAccessor.java had no such methods - added.
Diffstat (limited to 'src')
-rw-r--r-- | src/java/com/jogamp/common/nio/StructAccessor.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/java/com/jogamp/common/nio/StructAccessor.java b/src/java/com/jogamp/common/nio/StructAccessor.java index 41da290..eef9dc5 100644 --- a/src/java/com/jogamp/common/nio/StructAccessor.java +++ b/src/java/com/jogamp/common/nio/StructAccessor.java @@ -225,6 +225,19 @@ public class StructAccessor { } return v; } + + public final void setShortsAt(int byteOffset, short[] v) { + for (int i = 0; i < v.length; i++, byteOffset+=2) { + bb.putShort(byteOffset, v[i]); + } + } + + public final short[] getShortsAt(int byteOffset, short[] v) { + for (int i = 0; i < v.length; i++, byteOffset+=2) { + v[i] = bb.getShort(byteOffset); + } + return v; + } public final void setIntsAt(int byteOffset, int[] v) { for (int i = 0; i < v.length; i++, byteOffset+=4) { |