我怎么能转换Npp8u *到的CUdeviceptr [英] How can I convert Npp8u * to CUdeviceptr

查看:479
本文介绍了我怎么能转换Npp8u *到的CUdeviceptr的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的CUDA驱动程序API接口,但我认为的CUdeviceptr看起来像一个手柄parameter.So我感到困惑的CUdeviceptr和npp8u之间的皈依*。

I am new to cuda driver Api interface but I think that CUdeviceptr looks like a handle parameter.So I confused about the convertion between CUdeviceptr and npp8u *.

Npp8u * src;
......
unsigned char temp;
temp = src;
CUdeviceptr devPtr;
.......
devPtr = (CUdeviceptr)temp;

我试着写皈依像上面,是这样吗!

I try to write the convertion like above,is that right!

推荐答案

通过降级指针 unsigned char型转换为前的CUdeviceptr ,你是掩盖了所有但的src 最低显著8位。

By demoting the pointer to unsigned char before converting to CUdeviceptr, you are masking off all but the least significant 8 bits of src.

只要写:

Npp8u * SRC;
的CUdeviceptr devPtr =(的CUdeviceptr)(uintptr_t形式)的src;

这篇关于我怎么能转换Npp8u *到的CUdeviceptr的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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