本文介绍了具有标量参数的OpenCL Select方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下代码行,如果标量不为零,我希望a4的每个分量等于c4的对应分量,否则将其设置为b4的对应分量:
I have the following line of code, where I want each component of a4 to equal the corresponding component of c4 if scalar is non zero, otherwise set it to the corresponding component of b4:
uint4 a4 = select(b4, c4, (uint4)(scalar != 0));
但是,阅读选择文档后,似乎必须为要选择的c4组件设置MSB.
But, reading the select docs, it looks like MSB must be set for the c4 component to be chosen.
以上行正确吗?我感觉不是.
Is the above line correct? I have a feeling it is not.
推荐答案
原来,我只需要将第三个参数调整为: (uint4)标量!= 0
Turns out I just need to adjust the third argument to: (uint4)scalar != 0
这是正确的.
这篇关于具有标量参数的OpenCL Select方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!