From 47108a9bb6c972edc17453c12c98ec470eb7b80f Mon Sep 17 00:00:00 2001 From: Marko Viitanen Date: Thu, 25 Nov 2021 12:01:58 +0200 Subject: [PATCH] [tmvp] Change some variables to unsigned for ubsan error fix --- src/inter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/inter.c b/src/inter.c index 56c56ac0..e76fa544 100644 --- a/src/inter.c +++ b/src/inter.c @@ -1107,11 +1107,11 @@ static INLINE int16_t get_scaled_mv(int16_t mv, int scale) static int convert_mv_fixed_to_float(int32_t val) { - int sign = val >> 31; + uint32_t sign = val >> 31; int scale = kvz_math_floor_log2((val ^ sign) | MV_MANTISSA_UPPER_LIMIT) - (MV_MANTISSA_BITCOUNT - 1); int exponent; - int mantissa; + uint32_t mantissa; if (scale >= 0) { int round = (1 << scale) >> 1; @@ -1131,7 +1131,7 @@ static int convert_mv_fixed_to_float(int32_t val) static int convert_mv_float_to_fixed(int val) { int exponent = val & MV_EXPONENT_MASK; - int mantissa = val >> MV_EXPONENT_BITCOUNT; + uint32_t mantissa = val >> MV_EXPONENT_BITCOUNT; return exponent == 0 ? mantissa : (mantissa ^ MV_MANTISSA_LIMIT) << (exponent - 1); }