From eadd370d24b692a6228cb00b2d186ce1d8e241a1 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Wed, 19 May 2021 15:50:06 +0200 Subject: [PATCH] btstack_cvsd_plc: fix range test/warning --- src/classic/btstack_cvsd_plc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/classic/btstack_cvsd_plc.c b/src/classic/btstack_cvsd_plc.c index f458c9f3a..747c1e087 100644 --- a/src/classic/btstack_cvsd_plc.c +++ b/src/classic/btstack_cvsd_plc.c @@ -66,9 +66,10 @@ static float rcos[CVSD_OLAL] = { 0.13049554f,0.03376389f}; float btstack_cvsd_plc_rcos(int index){ - if (index > CVSD_OLAL) return 0; + if (index >= CVSD_OLAL) return 0; return rcos[index]; } + // taken from http://www.codeproject.com/Articles/69941/Best-Square-Root-Method-Algorithm-Function-Precisi // Algorithm: Babylonian Method + some manipulations on IEEE 32 bit floating point representation static float sqrt3(const float x){