在做加法时,比如两个255x255的数值相加,那么正确结果将是130050,对一个最大值为65565的unsigned short是会溢出的,但是如果使用L命令时,则不会产生溢出。这说明L命令,不是先执行计算再简单使之long,而是对计算结果就直接针对更宽位。下面代码可以验证。

    ushort data1[4] = {255*255};
uint16x4_t v0 = vld1_u16(data1);
uint16x4_t v1 = vld1_u16(data1); uint16x4_t res = vadd_u16(v0, v1);
uint32x4_t res0 = vaddl_u16(v0, v1);
uint32x4_t res1 = vaddq_u32(vmovl_u16(v0), vmovl_u16(v1));
uint r0[4], r1[4];
short res3[4];
ushort res2[4];
vst1q_u32(r0, res0);
vst1q_u32(r1, res1);
vst1_u16(res2, res);
vst1_s16(res3, vreinterpret_s16_u16(res)); OLOGD("32: %d %d %d %d %d %d %d %d", res0[0], res0[1], res0[2], res0[3], res1[0], res1[1], res1[2], res1[3]);
OLOGD("32 c: %d %d %d %d %d %d %d %d", r0[0], r0[1], r0[2], r0[3], r1[0], r1[1], r1[2], r1[3]);
OLOGD("u:%d %d %d %d s:%d %d %d %d", res2[0], res2[1], res2[2], res2[3], res3[0], res3[1], res3[2], res3[3]);

输出为

D/OLOG:32: 130050 0 0 0      130050 0 0 0
D/OLOG:32 c: 130050 0 0 0 130050 0 0 0
D/OLOG:u:64514 0 0 0 s:-1022 0 0 0

而且这个代码说明,可以直接对NEON的vector进行打印,而没必要先保存到CPU内存。

最新文章

  1. (转)从0开始搭建SQL Server AlwaysOn 第二篇(配置故障转移集群)
  2. Ionic 常用插件
  3. 使用EmBitz开发STM32项目的环境配置
  4. HttpModule的认识
  5. Ladda – 把加载提示效果集成到按钮中,提升用户体验
  6. POi写入大批量数据
  7. CentOS镜像163更新源
  8. Deppon接口开发
  9. [SQL]LeetCode182. 查找重复的电子邮箱 | Duplicate Emails
  10. MyBatis集成到Spring时配置MapperScannerConfigurer出错
  11. python-opencv boundingRect使用注意
  12. python3 集合的常用方法
  13. 《TCP/IP 详解 卷1:协议》第 10 章:用户数据报协议
  14. android基础---->音频和视频的使用
  15. 27.Remove Element(Array)
  16. 浅谈tcp_nodelay的作用
  17. JavaScript--3种函数调用的方法
  18. 《effective c++》读书笔记(上)
  19. create-react-native-app
  20. Go环境搭建(Windows)

热门文章

  1. 软件包管理rpm和yum
  2. B - Bash and a Tough Math Puzzle CodeForces - 914D (线段树的巧妙应用)
  3. PHP出现SSL certificate:unable to get local issuer certificate的解决办法
  4. web测试流程
  5. [V&N2020 公开赛]TimeTravel 复现
  6. 【考试总结】欢乐模拟赛_Day1
  7. 基于 Python 的自动文本提取:抽象法和生成法的比较
  8. c++动态数组的使用
  9. /proc/[pid]/status
  10. C++ Windows - How to get process path from its PID