库函数sqrt()占用时间几个US,有办法减小时间消耗吗?
请高手指点指点加钱解决问题 如果芯片自带FPU,就启用FPU,并使用固件库的arm_math.h 自己用汇编写肯定可以减少指令,不然用库肯定时间长 不要用库函数呗换一种写法 wenyangzeng 发表于 2019-9-29 09:50
如果芯片自带FPU,就启用FPU,并使用固件库的arm_math.h
用FPU能把时间压缩多少? scfor123456 发表于 2019-10-6 06:45
用FPU能把时间压缩多少?
开放运算用到浮点运算,使用FPU应该运算速度更快。 float CarmSqrt(float x){
15. union{
16. int intPart;
17. float floatPart;
18. } convertor;
19. union{
20. int intPart;
21. float floatPart;
22. } convertor2;
23. convertor.floatPart = x;
24. convertor2.floatPart = x;
25. convertor.intPart = 0x1FBCF800 + (convertor.intPart >> 1);
26. convertor2.intPart = 0x5f3759df - (convertor2.intPart >> 1);
27. return 0.5f*(convertor.floatPart + (x * convertor2.floatPart));
28. }
————————————————
版权声明:本文为CSDN博主「jieniyimiao」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:http://blog.csdn.net/u013467442/article/details/41147487 http://kb.cnblogs.com/page/189867/ bl2019 发表于 2019-10-7 15:23
float CarmSqrt(float x){
15. union{
这个是求开方函数吗?
页:
[1]
2