From 52c48cbe3f727c22d427b79e35a62feac802ead4 Mon Sep 17 00:00:00 2001 From: Felipe Neves Date: Thu, 23 Jan 2025 14:26:14 -0300 Subject: [PATCH] fix(vg_lite_math): initialize all variables to avoid error of uninitialized variables on some compilers. (#7628) Signed-off-by: Felipe Neves --- src/draw/vg_lite/lv_vg_lite_math.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/draw/vg_lite/lv_vg_lite_math.c b/src/draw/vg_lite/lv_vg_lite_math.c index 52b4bb950b..1354be73c8 100644 --- a/src/draw/vg_lite/lv_vg_lite_math.c +++ b/src/draw/vg_lite/lv_vg_lite_math.c @@ -39,13 +39,12 @@ float math_fast_inv_sqrtf(float number) { - int32_t i; - float x2, y; const float threehalfs = 1.5f; - x2 = number * 0.5f; - y = number; - i = *(int32_t *)&y; /* evil floating point bit level hacking */ + float x2 = number * 0.5f; + float y = number; + int32_t i = *(int32_t *)&y; /* evil floating point bit level hacking */ + i = 0x5f3759df /* floating-point representation of an approximation of {\sqrt {2^{127}}}} see https://en.wikipedia.org/wiki/Fast_inverse_square_root. */ - (i >> 1);