diff options
author | James Almer <jamrial@gmail.com> | 2015-03-18 15:08:45 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2015-03-20 15:47:31 -0300 |
commit | d13e521cc861e791545dd6022fbf93f821e33618 (patch) | |
tree | 6433d7ed5f982fcbc5d7f9cf5e0462b849741ab2 /libavutil/common.h | |
parent | 2a8198b32f27802c20cd11eedac9eb175d463496 (diff) | |
download | ffmpeg-d13e521cc861e791545dd6022fbf93f821e33618.tar.gz |
libavutil: add av_mod_uintp2
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavutil/common.h')
-rw-r--r-- | libavutil/common.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libavutil/common.h b/libavutil/common.h index 852c1de850..3e62b6d5b7 100644 --- a/libavutil/common.h +++ b/libavutil/common.h @@ -211,6 +211,17 @@ static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p) } /** + * Clear high bits from an unsigned integer starting with specific bit position + * @param a value to clip + * @param p bit position to clip at + * @return clipped value + */ +static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p) +{ + return a & ((1 << p) - 1); +} + +/** * Add two signed 32-bit values with saturation. * * @param a one value @@ -466,6 +477,9 @@ static av_always_inline av_const int av_popcount64_c(uint64_t x) #ifndef av_clip_uintp2 # define av_clip_uintp2 av_clip_uintp2_c #endif +#ifndef av_mod_uintp2 +# define av_mod_uintp2 av_mod_uintp2_c +#endif #ifndef av_sat_add32 # define av_sat_add32 av_sat_add32_c #endif |