From 4614bf2caf67a89c2d833b3368f325eab54582bc Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 20 Feb 2017 19:34:54 +0100 Subject: Factorize CHECK/SUINT code Signed-off-by: Michael Niedermayer --- libavutil/internal.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libavutil') diff --git a/libavutil/internal.h b/libavutil/internal.h index 4d1b3e2c18..7780a9a791 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -262,6 +262,16 @@ void avpriv_request_sample(void *avc, # define ff_dlog(ctx, ...) do { if (0) av_log(ctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0) #endif +// For debuging we use signed operations so overflows can be detected (by ubsan) +// For production we use unsigned so there are no undefined operations +#ifdef CHECKED +#define SUINT int +#define SUINT32 int32_t +#else +#define SUINT unsigned +#define SUINT32 uint32_t +#endif + /** * Clip and convert a double value into the long long amin-amax range. * This function is needed because conversion of floating point to integers when -- cgit v1.2.3