aboutsummaryrefslogtreecommitdiff
path: root/libavutil/softfloat.h
diff options
context:
space:
mode:
authorMichael Niedermayer2014-10-10 19:36:12 +0200
committerMichael Niedermayer2014-10-10 19:36:12 +0200
commit171d971dbf046c25bf3b4da4eaa26cc645ed8998 (patch)
treebf19c146598c67cd146bd9981fe8d4bfebd64aec /libavutil/softfloat.h
parent5e6fd132ff5611b8af2d3c7506f0328858fc3de1 (diff)
avutil/softfloat: Fix undefined shift in av_add_sf()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/softfloat.h')
-rw-r--r--libavutil/softfloat.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h
index fc083e559b..8647e6a4fc 100644
--- a/libavutil/softfloat.h
+++ b/libavutil/softfloat.h
@@ -104,8 +104,10 @@ static inline av_const int av_cmp_sf(SoftFloat a, SoftFloat b){
static inline av_const SoftFloat av_add_sf(SoftFloat a, SoftFloat b){
int t= a.exp - b.exp;
- if(t<0) return av_normalize1_sf((SoftFloat){b.exp, b.mant + (a.mant >> (-t))});
- else return av_normalize1_sf((SoftFloat){a.exp, a.mant + (b.mant >> t )});
+ if (t <-31) return b;
+ else if (t < 0) return av_normalize1_sf((SoftFloat){b.exp, b.mant + (a.mant >> (-t))});
+ else if (t < 32) return av_normalize1_sf((SoftFloat){a.exp, a.mant + (b.mant >> t )});
+ else return a;
}
static inline av_const SoftFloat av_sub_sf(SoftFloat a, SoftFloat b){