[FFmpeg-devel] [PATCH 2/2] Use gcc/clang builtins for av_sat_(add|sub)_64_c if available.

Dale Curtis dalecurtis at chromium.org
Fri May 1 21:44:20 EEST 2020


On Fri, May 1, 2020 at 11:22 AM James Almer <jamrial at gmail.com> wrote:

> On 5/1/2020 3:07 PM, Carl Eugen Hoyos wrote:
> > Am Fr., 1. Mai 2020 um 19:24 Uhr schrieb Dale Curtis <
> dalecurtis at chromium.org>:
> >>
> >> Signed-off-by: Dale Curtis <dalecurtis at chromium.org>
> >> ---
> >>  libavutil/common.h | 10 ++++++++++
> >>  1 file changed, 10 insertions(+)
> >
> > Imo, this is guaranteed to break x86 compilation with some unusual
> > toolchain.
> > I looked carefully at all occurrences of AV_GCC_VERSION_AT_LEAST()
> > and I believe they are in fact different (not for x86 or combined with
> other
> > checks).
>
> Can you elaborate on this? AV_GCC_VERSION_AT_LEAST() is a public macro
> used in public headers to choose one or another path depending on if the
> compiler is a recent enough GCC, or something else.
> What toolchain could this break, and why specifically x86?
> __builtin_*_overflow are arch agnostic GCC functions.
>
>
Yes this is accurate. Actual rebased patch.
https://gcc.gnu.org/onlinedocs/gcc/Integer-Overflow-Builtins.html
https://releases.llvm.org/4.0.0/tools/clang/docs/LanguageExtensions.html#checked-arithmetic-builtins


- dale
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sat_math_builtin_v2.patch
Type: application/x-patch
Size: 1589 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200501/9ccae5a8/attachment.bin>


More information about the ffmpeg-devel mailing list