• Peter Meerwald's avatar
    libavutil: Add av_clip_intp2 · bf07d813
    Peter Meerwald authored
    there already is a function, av_clip_uintp2() that clips a signed integer
    to an unsigned power-of-two range, i.e. 0,2^p-1
    
    this patch adds a function av_clip_intp2() that clips a signed integer
    to a signed power-of-two range, i.e. -(2^p),(2^p-1)
    
    the new function can be used as a special case for av_clip(), e.g.
    av_clip(x, -8192, 8191) can be rewritten as av_clip_intp2(x, 13)
    
    there are ARM instructions, usat and ssat resp., which map nicely to these
    functions (see next patch)
    Signed-off-by: 's avatarPeter Meerwald <pmeerw@pmeerw.net>
    Signed-off-by: 's avatarLuca Barbato <lu_zero@gentoo.org>
    bf07d813
common.h 11.9 KB