[FFmpeg-devel] [PATCH] lavu/common: add av_clipl_uint32_c

Lukasz M lukasz.m.luki at gmail.com
Thu Nov 21 23:46:21 CET 2013


On 21 November 2013 20:11, Michael Niedermayer <michaelni at gmx.at> wrote:

> On Thu, Nov 21, 2013 at 01:42:38AM +0100, Lukasz Marek wrote:
> > Signed-off-by: Lukasz Marek <lukasz.m.luki at gmail.com>
> > ---
> >  libavutil/common.h  | 11 +++++++++++
> >  libavutil/version.h |  2 +-
> >  2 files changed, 12 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavutil/common.h b/libavutil/common.h
> > index e487218..3b92359 100644
> > --- a/libavutil/common.h
> > +++ b/libavutil/common.h
> > @@ -173,6 +173,17 @@ static av_always_inline av_const int16_t
> av_clip_int16_c(int a)
> >  }
> >
> >  /**
> > + * Clip a signed 64-bit integer value into the 0 - 4294967295 range.
> > + * @param a value to clip
> > + * @return clipped value
> > + */
> > +static av_always_inline av_const uint32_t av_clipl_uint32_c(int64_t a)
> > +{
> > +    if (a & INT64_C(~0xFFFFFFFF)) return (uint32_t)((-a)>>63);
>
> ~0xFFFFFFFF == 0
> so this looks a bit strange


Fixed commit in attachment.
Both versions produce the same output anyway assuming macro always append
UL(L)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lavu-common-add-av_clipl_uint32_c.patch
Type: text/x-patch
Size: 1473 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131121/3e258f9d/attachment.bin>


More information about the ffmpeg-devel mailing list