summaryrefslogtreecommitdiffstats
path: root/src/com/mbien/opencl/CLUtils.java
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-01-19 00:14:28 +0100
committerMichael Bien <[email protected]>2010-01-19 00:14:28 +0100
commit21f0d9231227a4d2c96cb70b5061c18145591fba (patch)
tree392c64edb0571127fb83ccb003d491f179a0efa2 /src/com/mbien/opencl/CLUtils.java
parent09ac312a0645bd0d9adff580f29f20382dfbf8c9 (diff)
temporary dissabled non direct NIO binding for methods containing long[] since its broken on 32bit systems.
refactored high level binding to use direct NIO exclusively. temporary dissabled low level binding junit tests. green bar on 32 and 64 bit systems.
Diffstat (limited to 'src/com/mbien/opencl/CLUtils.java')
-rw-r--r--src/com/mbien/opencl/CLUtils.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/com/mbien/opencl/CLUtils.java b/src/com/mbien/opencl/CLUtils.java
index c19292b6..a926e8ed 100644
--- a/src/com/mbien/opencl/CLUtils.java
+++ b/src/com/mbien/opencl/CLUtils.java
@@ -1,5 +1,7 @@
package com.mbien.opencl;
+import java.nio.ByteBuffer;
+
/**
*
* @author Michael Bien
@@ -10,4 +12,14 @@ class CLUtils {
return clLength==0 ? "" : new String(chars, 0, clLength-1);
}
+ public static String clString2JavaString(ByteBuffer chars, int clLength) {
+ if (clLength==0) {
+ return "";
+ }else{
+ byte[] array = new byte[clLength-1]; // last char is always null
+ chars.get(array).rewind();
+ return new String(array, 0, clLength-1);
+ }
+ }
+
}