diff mbox

[PATCHv2,07/10] linux-generic: tm: avoid underflow on log2 of 0

Message ID 1464275685-18426-8-git-send-email-bill.fischofer@linaro.org
State New
Headers show

Commit Message

Bill Fischofer May 26, 2016, 3:14 p.m. UTC
Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 platform/linux-generic/odp_timer_wheel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/platform/linux-generic/odp_timer_wheel.c b/platform/linux-generic/odp_timer_wheel.c
index a8717b7..c6d2026 100644
--- a/platform/linux-generic/odp_timer_wheel.c
+++ b/platform/linux-generic/odp_timer_wheel.c
@@ -171,7 +171,7 @@  static uint32_t _odp_internal_ilog2(uint64_t value)
 		if (value == pwr_of_2)
 			return bit_shift;
 		else if (value < pwr_of_2)
-			return bit_shift - 1;
+			return (uint32_t)((int32_t)bit_shift - 1);
 	}
 
 	return 64;