On 1/19/2016 9:46 AM, John Cox wrote: > +// Helper fns > +#ifndef hevc_mem_bits32 > +static av_always_inline uint32_t hevc_mem_bits32(const void * buf, const > unsigned int offset) > +{ > + return AV_RB32((const uint8_t *)buf + (offset >> 3)) << (offset & 7); > +} > +#endif > + > +#if AV_GCC_VERSION_AT_LEAST(3,4) && !defined(hevc_clz32) > +#define hevc_clz32 hevc_clz32_builtin > +static av_always_inline unsigned int hevc_clz32_builtin(const uint32_t x) > +{ > + // __builtin_clz says it works on ints - so adjust if int is >32 bits > long > + return __builtin_clz(x) - (sizeof(int) * 8 - 32);
Why aren't you simply using ff_clz? > +} > +#endif > + > +// It is unlikely that we will ever need this but include for completeness There are at least two compilers we support that don't define __GNUC__, so it would be used. And in any case, isn't all this duplicating ff_clz, which is available in libavutil/inthmath.h? > +#ifndef hevc_clz32 > +static inline unsigned int hevc_clz32(unsigned int x) > +{ > + unsigned int n = 1; > + if ((x & 0xffff0000) == 0) { > + n += 16; > + x <<= 16; > + } > + if ((x & 0xff000000) == 0) { > + n += 8; > + x <<= 8; > + } > + if ((x & 0xf0000000) == 0) { > + n += 4; > + x <<= 4; > + } > + if ((x & 0xc0000000) == 0) { > + n += 2; > + x <<= 2; > + } > + return n - ((x >> 31) & 1); > +} > +#endif _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel