mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avutil/softfloat: Fix overflows in shifts in av_cmp_sf() and av_gt_sf()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
df2a2117d2
commit
cee3c9d29a
@ -119,15 +119,19 @@ static inline av_const SoftFloat av_div_sf(SoftFloat a, SoftFloat b){
|
|||||||
|
|
||||||
static inline av_const int av_cmp_sf(SoftFloat a, SoftFloat b){
|
static inline av_const int av_cmp_sf(SoftFloat a, SoftFloat b){
|
||||||
int t= a.exp - b.exp;
|
int t= a.exp - b.exp;
|
||||||
if(t<0) return (a.mant >> (-t)) - b.mant ;
|
if (t <-31) return - b.mant ;
|
||||||
else return a.mant - (b.mant >> t);
|
else if (t < 0) return (a.mant >> (-t)) - b.mant ;
|
||||||
|
else if (t < 32) return a.mant - (b.mant >> t);
|
||||||
|
else return a.mant ;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline av_const int av_gt_sf(SoftFloat a, SoftFloat b)
|
static inline av_const int av_gt_sf(SoftFloat a, SoftFloat b)
|
||||||
{
|
{
|
||||||
int t= a.exp - b.exp;
|
int t= a.exp - b.exp;
|
||||||
if(t<0) return (a.mant >> (-t)) > b.mant ;
|
if (t <-31) return 0;
|
||||||
else return a.mant > (b.mant >> t);
|
else if (t < 0) return (a.mant >> (-t)) > b.mant ;
|
||||||
|
else if (t < 32) return a.mant > (b.mant >> t);
|
||||||
|
else return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline av_const SoftFloat av_add_sf(SoftFloat a, SoftFloat b){
|
static inline av_const SoftFloat av_add_sf(SoftFloat a, SoftFloat b){
|
||||||
|
Loading…
Reference in New Issue
Block a user