diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-07-05 01:50:58 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-07-05 01:50:58 +0400 |
commit | 46ad287a2a87554bb10dff437dfad7edcd38bb69 (patch) | |
tree | 064d43df20364549493c0a34f7bb093349ed9855 /libavutil/rational.c | |
parent | 65abce67b52c920d1f6f691a883ec787773916fd (diff) |
avutil/rational: avoid llrint() and rint()
This should workaround issues with these functions on ia64 and sparc64
Fixes Ticket2713
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/rational.c')
-rw-r--r-- | libavutil/rational.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavutil/rational.c b/libavutil/rational.c index aabe58f684..ec2f2e5386 100644 --- a/libavutil/rational.c +++ b/libavutil/rational.c @@ -114,9 +114,10 @@ AVRational av_d2q(double d, int max) return (AVRational) { d < 0 ? -1 : 1, 0 }; exponent = FFMAX( (int)(log(fabs(d) + 1e-20)/LOG2), 0); den = 1LL << (61 - exponent); - av_reduce(&a.num, &a.den, rint(d * den), den, max); + // (int64_t)rint() and llrint() do not work with gcc on ia64 and sparc64 + av_reduce(&a.num, &a.den, floor(d * den + 0.5), den, max); if ((!a.num || !a.den) && d && max>0 && max<INT_MAX) - av_reduce(&a.num, &a.den, llrint(d * den), den, INT_MAX); + av_reduce(&a.num, &a.den, floor(d * den + 0.5), den, INT_MAX); return a; } |