0eead94181
`asm` is not part of the C standard and causes a complier error when `-std=c99` is used. `__asm__` is the recommended alternative. https://gcc.gnu.org/onlinedocs/gcc/extensions-to-the-c-language-family/alternate-keywords.html Signed-off-by: David Lechner <david@pybricks.com>
12 lines
248 B
C
12 lines
248 B
C
// 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;
|
|
}
|