diff options
Diffstat (limited to 'libavutil/common.h')
-rw-r--r-- | libavutil/common.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libavutil/common.h b/libavutil/common.h index 11ae368826..8d7cc10012 100644 --- a/libavutil/common.h +++ b/libavutil/common.h @@ -145,6 +145,17 @@ static inline av_const int16_t av_clip_int16(int a) } /** + * Clips a signed 64-bit integer value into the -2147483648,2147483647 range. + * @param a value to clip + * @return clipped value + */ +static inline av_const int32_t av_clipl_int32(int64_t a) +{ + if ((a+2147483648) & ~2147483647) return (a>>63) ^ 2147483647; + else return a; +} + +/** * Clips a float value into the amin-amax range. * @param a value to clip * @param amin minimum value of the clip range |