From aa9eb7b234b8429933e2be4835be6e77cf1d0298 Mon Sep 17 00:00:00 2001 From: Antoine SOULIER Date: Fri, 13 May 2022 10:22:51 +0200 Subject: [PATCH] sanitizer: prevent sub that result in negative unsigned result --- src/fastmath.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fastmath.h b/src/fastmath.h index 32cf79e..4210f2e 100644 --- a/src/fastmath.h +++ b/src/fastmath.h @@ -147,7 +147,7 @@ static inline int32_t fast_db_q16(float x) union { float f; uint32_t u; } x2 = { .f = x*x }; - int e2 = (x2.u >> 22) - 2*127; + int e2 = (int)(x2.u >> 22) - 2*127; int hi = (x2.u >> 18) & 0x1f; int lo = (x2.u >> 2) & 0xffff;