summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-03-23 04:05:03 +0100
committerSven Gothel <[email protected]>2015-03-23 04:05:03 +0100
commitb755b045fb7e3c8306f24dd645297992ab8db7f9 (patch)
tree4be9dfb52b0e0ed91d5376ef1d770552d3252d1e /src/java/com/jogamp/common
parent532b8df474976b474f0cf4eb2d93588ded2ad3fe (diff)
Bug 1149 - Replacing PCPP w/ JCPP, allowing complete macro handling (Part-1: Cleanup / Preparation)
Diffstat (limited to 'src/java/com/jogamp/common')
-rw-r--r--src/java/com/jogamp/common/nio/StructAccessor.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/java/com/jogamp/common/nio/StructAccessor.java b/src/java/com/jogamp/common/nio/StructAccessor.java
index af7b6d1..8ae0c29 100644
--- a/src/java/com/jogamp/common/nio/StructAccessor.java
+++ b/src/java/com/jogamp/common/nio/StructAccessor.java
@@ -83,6 +83,16 @@ public class StructAccessor {
bb.put(byteOffset, v);
}
+ /** Retrieves the boolean at the specified byteOffset. */
+ public final boolean getBooleanAt(final int byteOffset) {
+ return (byte)0 != bb.get(byteOffset);
+ }
+
+ /** Puts a boolean at the specified byteOffset. */
+ public final void setBooleanAt(final int byteOffset, final boolean v) {
+ bb.put(byteOffset, v?(byte)1:(byte)0);
+ }
+
/** Retrieves the char at the specified byteOffset. */
public final char getCharAt(final int byteOffset) {
return bb.getChar(byteOffset);
@@ -213,6 +223,19 @@ public class StructAccessor {
return v;
}
+ public final void setBooleansAt(int byteOffset, final boolean[] v) {
+ for (int i = 0; i < v.length; i++) {
+ bb.put(byteOffset++, v[i]?(byte)1:(byte)0);
+ }
+ }
+
+ public final boolean[] getBooleansAt(int byteOffset, final boolean[] v) {
+ for (int i = 0; i < v.length; i++) {
+ v[i] = (byte)0 != bb.get(byteOffset++);
+ }
+ return v;
+ }
+
public final void setCharsAt(int byteOffset, final char[] v) {
for (int i = 0; i < v.length; i++, byteOffset+=2) {
bb.putChar(byteOffset, v[i]);