diff options
author | Michael Bien <[email protected]> | 2009-10-22 13:03:53 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2009-10-22 13:03:53 +0200 |
commit | 503845224a820c0b9ce9204aa6215519f6b93c36 (patch) | |
tree | b675747824468377685a4e6408a269b43b78c9f1 /src/com/mbien/opencl/CLContext.java | |
parent | b3881a0924ecbe17cf27cededeae8df40b2d6933 (diff) |
32bit compatibility.
Diffstat (limited to 'src/com/mbien/opencl/CLContext.java')
-rw-r--r-- | src/com/mbien/opencl/CLContext.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/com/mbien/opencl/CLContext.java b/src/com/mbien/opencl/CLContext.java index 7eaada8c..a82092bb 100644 --- a/src/com/mbien/opencl/CLContext.java +++ b/src/com/mbien/opencl/CLContext.java @@ -2,6 +2,7 @@ package com.mbien.opencl; import com.mbien.opencl.CLBuffer.MEM; import com.sun.gluegen.runtime.BufferFactory; +import com.sun.gluegen.runtime.CPU; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -217,7 +218,7 @@ public final class CLContext { if(devices == null) { - int sizeofDeviceID = 8; // TODO doublecheck deviceID size on 32 bit systems + int sizeofDeviceID = CPU.is32Bit()?4:8; long[] longBuffer = new long[1]; @@ -231,9 +232,10 @@ public final class CLContext { checkForError(ret, "can not enumerate devices"); devices = new CLDevice[deviceIDs.capacity()/sizeofDeviceID]; - for (int i = 0; i < devices.length; i++) - devices[i] = new CLDevice(this, deviceIDs.getLong()); // TODO doublecheck deviceID size on 32 bit systems - + for (int i = 0; i < devices.length; i++) { + devices[i] = new CLDevice(this, + CPU.is32Bit()?deviceIDs.getInt():deviceIDs.getLong()); + } } return devices; |