int pbSize = NativeSizeBuffer.elementSize();
int deviceCount = binaries.size();
CachedBufferFactory bf = CachedBufferFactory.create(binarySize + pbSize*deviceCount*3 + 4, true);
NativeSizeBuffer devices = NativeSizeBuffer.wrap(bf.newDirectByteBuffer(deviceCount*pbSize));
PointerBuffer codeBuffers = PointerBuffer.wrap(bf.newDirectByteBuffer(deviceCount*pbSize));
NativeSizeBuffer lengths = NativeSizeBuffer.wrap(bf.newDirectByteBuffer(deviceCount*pbSize));
int i = 0;
for (Map.Entry<CLDevice, byte[]> entry : entries) {
byte[] bytes = entry.getValue();
CLDevice device = entry.getKey();
devices.put(device.ID);
lengths.put(bytes.length);
codeBuffers.referenceBuffer(i, bf.newDirectByteBuffer(bytes));
i++;
}
devices.rewind();
lengths.rewind();