Fastest Inverse Square Root on iPhone

前端 未结 2 1617
广开言路
广开言路 2021-01-18 12:00

I\'m working on an iPhone app that involves certain physics calculations that are done thousands of times per second. I am working on optimizing the code to improve the fra

相关标签:
2条回答
  • 2021-01-18 12:44

    https://code.google.com/p/math-neon/source/browse/trunk/math_sqrtf.c <- there's a neon implementation of invsqrt there, you should be able to copy the assembly bit as-is

    0 讨论(0)
  • 2021-01-18 12:49

    The accepted answer of the question you've linked already provides the answer, but doesn't spell it out:

    #import <arm_neon.h>
    
    void foo() {
        float32x2_t inverseSqrt = vrsqrte_f32(someFloat);
    }
    

    Header and function are already provided by the iOS SDK.

    0 讨论(0)
提交回复
热议问题