[Ffmpeg-devel] [PATCH] use libavutil macros in libpostproc

Rich Felker dalias
Tue Oct 10 17:43:25 CEST 2006


On Tue, Oct 10, 2006 at 02:33:31AM +0100, M?ns Rullg?rd wrote:
> 
> Aurelien Jacobs said:
> > On Tue, 10 Oct 2006 01:23:23 +0200
> > Diego Biurrun <diego at biurrun.de> wrote:
> >
> >> $subject, plus put the SIGN macro in libavutil/common.h as well, it
> >> might be useful in other places.
> >>
> >> Index: libavutil/common.h
> >> ===================================================================
> >> --- libavutil/common.h	(revision 6612)
> >> +++ libavutil/common.h	(working copy)
> >> @@ -193,6 +193,7 @@
> >>  /* assume b>0 */
> >>  #define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
> >>  #define ABS(a) ((a) >= 0 ? (a) : (-(a)))
> >> +#define SIGN(a) ((a) > 0 ? 1 : -1)
> >
> > Maybe use this instead ? (but I don't know if it's worth)
> >
> >   +#define SIGN(a) ((((a) > 0) - 1) | 1)     /* same as ((a) > 0 ? 1 : -1) */
> 
> Or (((a)>>(sizeof(a)*CHAR_BIT-1))|1).

Or (((a)>>(sizeof(a)*8-1))|1)....

Sorry it just annoys me how ppl keep treating CHAR_BIT as anything
other than a universal constant. It's like using #define TRUE 1 in C
code...

Rich





More information about the ffmpeg-devel mailing list