[FFmpeg-devel] [PATCH] [libavutil] Add saturated add/sub operations for int64_t.

Dale Curtis dalecurtis at chromium.org
Fri May 1 01:19:39 EEST 2020


Many places are using their own custom code for handling overflow
around timestamps or other int64_t values. There are enough of these
now that having some common saturated math functions seems sound.

This adds implementations that just use the builtin functions for
recent gcc, clang when available or implements its own version for
older compilers.

Signed-off-by: Dale Curtis <dalecurtis at chromium.org>
---
 libavutil/mathematics.c | 26 ++++++++++++++++++++++++++
 libavutil/mathematics.h | 19 +++++++++++++++++++
 2 files changed, 45 insertions(+)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sat_math_v0.patch
Type: application/octet-stream
Size: 3003 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200430/a0fc215b/attachment.obj>


More information about the ffmpeg-devel mailing list