Can any one tell me how to typecast a char*
pointer to int*
in OpenCL kernel function??
I tried ((int*) char_pointer)
but it is not working.
相关问题
- Multiple sockets for clients to connect to
- Do the Java Integer and Double objects have unnece
- How to know full paths to DLL's from .csproj f
- Importing NuGet references through a local project
- What is the best way to do a search in a large fil
Stuff the pointers in a union, initialize with a char*, use it with the int*:
Ugly, but does the trick without casts, at least in C. It's undefined behaviour, but hey, you're not using this in a heart monitor or with nuclear warheads at the other end, right?
You have to qualify the pointer with the correct address space, I think.
If you don't specify the address space,
__private
is assumed, but your source pointer seems to be a__global
pointer (from your comment), so the address spaces are incompatible.So try to use
(__global int*)
instead of just(int*)
.