Iphone 解释霓虹灯的本质问题
好吧,我在最后一天一直在磕头,我相信这很简单,就这样吧。为什么这个代码不起作用?我使用的是Xcode 3.2.5和LLVM,当我尝试编译如下内容时:Iphone 解释霓虹灯的本质问题,iphone,llvm,neon,Iphone,Llvm,Neon,好吧,我在最后一天一直在磕头,我相信这很简单,就这样吧。为什么这个代码不起作用?我使用的是Xcode 3.2.5和LLVM,当我尝试编译如下内容时: uint16x8_t testUnsigned = {1,2,3,4,5,6,7,8}; int16x8_t testSigned; testSigned = vreinterpretq_s16_u16(testUnsigned); 我得到一个错误:“从不兼容的类型'int'分配给'int16x8_t'”我
uint16x8_t testUnsigned = {1,2,3,4,5,6,7,8};
int16x8_t testSigned;
testSigned = vreinterpretq_s16_u16(testUnsigned);
我得到一个错误:“从不兼容的类型'int'分配给'int16x8_t'”我的所有其他内部函数都可以正常工作,但由于某些原因,我无法重新解释向量。有什么想法吗?提前感谢。/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/lib/gcc/arm-apple-darwin10/4.2.1/include/arm\u neon\u gcc.h:6947
#define vreinterpretq_s16_u16(__a) \
(int16x8_t)__builtin_neon_vreinterpretv8hiv8hi ((int16x8_t) __a)
这看起来像是参数的类型是有符号的int。它闻起来像个bug。
我不确定,但你应该试试
testSigned = vreinterpretq_s16_u16((int16x8_t)testUnsigned);
/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/lib/gcc/arm-apple-darwin10/4.2.1/include/arm\u neon\u gcc.h:6947
#define vreinterpretq_s16_u16(__a) \
(int16x8_t)__builtin_neon_vreinterpretv8hiv8hi ((int16x8_t) __a)
这看起来像是参数的类型是有符号的int。它闻起来像个bug。
我不确定,但你应该试试
testSigned = vreinterpretq_s16_u16((int16x8_t)testUnsigned);
正如Hiroshi所指出的,这个特定的调用似乎有一个bug。但是,由于它只是在引擎盖下进行强制转换,因此您可以通过任何其他类型进行转换,而不会受到任何运行时惩罚。例如,我进行了测试,结果如下:
testSigned = vreinterpretq_s16_f32(vreinterpretq_f32_u16(testUnsigned));
正如Hiroshi所指出的,这个特定的调用似乎有一个bug。但是,由于它只是在引擎盖下进行强制转换,因此您可以通过任何其他类型进行转换,而不会受到任何运行时惩罚。例如,我进行了测试,结果如下:
testSigned = vreinterpretq_s16_f32(vreinterpretq_f32_u16(testUnsigned));
唉,编译器禁止此类c样式转换。唉,编译器禁止此类c样式转换。