Revision 1550f45a libavutil/common.h

View differences:

libavutil/common.h
170 170
}
171 171

  
172 172
/**
173
 * Clip a signed integer to an unsigned power of two range.
174
 * @param  a value to clip
175
 * @param  p bit position to clip at
176
 * @return clipped value
177
 */
178
static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
179
{
180
    if (a & ~((1<<p) - 1)) return -a >> 31 & ((1<<p) - 1);
181
    else                   return  a;
182
}
183

  
184
/**
173 185
 * Clip a float value into the amin-amax range.
174 186
 * @param a value to clip
175 187
 * @param amin minimum value of the clip range
......
362 374
#ifndef av_clipl_int32
363 375
#   define av_clipl_int32   av_clipl_int32_c
364 376
#endif
377
#ifndef av_clip_uintp2
378
#   define av_clip_uintp2   av_clip_uintp2_c
379
#endif
365 380
#ifndef av_clipf
366 381
#   define av_clipf         av_clipf_c
367 382
#endif

Also available in: Unified diff