如何类型转换的char *为int * OpenCL中 [英] How to type-cast char* to int* in openCL

查看:308
本文介绍了如何类型转换的char *为int * OpenCL中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何一个可以告诉我如何强制转换一个的char * 指针为int * 中的OpenCL内核函数?
我试图((INT *)char_pointer),但它不工作。

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.

推荐答案

您有资格使用正确的地址空间指针,我想。

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.

所以,尽量使用(__全球INT *),而不是仅仅(INT *)

So try to use (__global int*) instead of just (int*).

这篇关于如何类型转换的char *为int * OpenCL中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆