1

One of the arguments for CL12.clCreateImage() is a ByteBuffer containing this struct. I will be using the method described in OpenCL kernel arguments to pass the struct but am not certain what to use for the arguments that are of type size_t. From Java,when I put the arguments into the ByteBuffer, should I use an int (signed 32 bit) if I am using a 32-bit system or a long (signed 64 bits) if I am using a 64-bit?

Community
  • 1
  • 1
vandale
  • 3,600
  • 3
  • 22
  • 39

1 Answers1

-2

a size_t type is an "unsigned int". You can definitely use int type but make sure it is not a negative number, otherwise it makes no sense.

When considering the above, You should not worry about 32 and 64 bit systems and you should not need to use a long

so you can do something like

int param = value; //this is the value to pass
if (param >= 0) {
  pclFunc((size_t)param)
} else {
  //see how you want to handle this
}
Moataz Elmasry
  • 2,509
  • 4
  • 27
  • 37