From 43264a946f0222e49ac2c10da7d00b36efc3f40e Mon Sep 17 00:00:00 2001 From: Frank Gevaerts Date: Wed, 10 Feb 2010 19:44:11 +0000 Subject: New plugin: FFT, A frequency analyzer plugin There is some more work needed: - Keymaps are definitely not perfect, touchscreen targets are disabled due to no keymap - There is no manual yet Author: Delyan Kratunov Flyspray: FS#10065 git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24587 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/fft/math.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 apps/plugins/fft/math.c (limited to 'apps/plugins/fft/math.c') diff --git a/apps/plugins/fft/math.c b/apps/plugins/fft/math.c new file mode 100644 index 0000000000..c00804fcc8 --- /dev/null +++ b/apps/plugins/fft/math.c @@ -0,0 +1,13 @@ +#include "math.h" + +int64_t fsqrt64(int64_t a, unsigned int fracbits) +{ + int64_t b = a/2 + (1 << fracbits); /* initial approximation */ + unsigned int n; + const unsigned int iterations = 3; /* very rough approximation */ + + for (n = 0; n < iterations; ++n) + b = (b + (((int64_t)(a) << fracbits)/b))/2; + + return b; +} -- cgit v1.2.3