Skip to content
Snippets Groups Projects
Select Git revision
  • cd527bb324ade952d11a134859d38bf5272c165e
  • wip-bootstrap default
  • dualcore
  • ch3/leds
  • ch3/time
  • master
6 results

thumb_vfp_sqrtf.c

Blame
  • user avatar
    Damien George authored
    This allows it to be used only when the hardware supports VFP
    instructions, preventing compile errors.
    cd527bb3
    History
    thumb_vfp_sqrtf.c 244 B
    // an implementation of sqrtf for Thumb using hardware VFP instructions
    
    #include <math.h>
    
    float sqrtf(float x) {
        asm volatile (
                "vsqrt.f32  %[r], %[x]\n"
                : [r] "=t" (x)
                : [x] "t"  (x));
        return x;
    }