From 41b927442e770d6f2303d32f88a96b859775b27f Mon Sep 17 00:00:00 2001 From: Vic Yang Date: Fri, 26 Sep 2014 15:27:03 +0800 Subject: Fix floating point usage in lightbar module This patch fixes stary floating point usage in lightbar module. They should be scaled by FP_SCALE and of type 'int'. BUG=None TEST=Compile and make sure the compiler is not using floating point related instructions. BRANCH=None Change-Id: I8d598af1014160b83bc44ef3e88e2cc4bf304e5e Signed-off-by: Vic Yang Reviewed-on: https://chromium-review.googlesource.com/220121 Reviewed-by: Bill Richardson Reviewed-by: Randall Spangler Reviewed-by: Eric Caruso --- common/lightbar.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/lightbar.c b/common/lightbar.c index e7733bdf4b..8065996fce 100644 --- a/common/lightbar.c +++ b/common/lightbar.c @@ -1162,7 +1162,7 @@ static inline int get_interp_value(int led, int color, int interp) static uint32_t lightbyte_RAMP_ONCE(void) { int w, i, r, g, b; - float f; + int f; /* special case for instantaneous set */ if (lb_ramp_delay == 0) { @@ -1176,7 +1176,7 @@ static uint32_t lightbyte_RAMP_ONCE(void) } for (w = 0; w < 128; w++) { - f = cycle_010(w); + f = cycle_010(w) * FP_SCALE; for (i = 0; i < NUM_LEDS; i++) { r = get_interp_value(i, LB_COL_RED, f); g = get_interp_value(i, LB_COL_GREEN, f); @@ -1198,7 +1198,7 @@ static uint32_t lightbyte_RAMP_ONCE(void) static uint32_t lightbyte_CYCLE_ONCE(void) { int w, i, r, g, b; - float f; + int f; /* special case for instantaneous set */ if (lb_ramp_delay == 0) { @@ -1212,7 +1212,7 @@ static uint32_t lightbyte_CYCLE_ONCE(void) } for (w = 0; w < 256; w++) { - f = cycle_010(w); + f = cycle_010(w) * FP_SCALE; for (i = 0; i < NUM_LEDS; i++) { r = get_interp_value(i, LB_COL_RED, f); g = get_interp_value(i, LB_COL_GREEN, f); -- cgit v1.2.1