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

Måns Rullgård mru
Tue Oct 10 03:33:31 CEST 2006


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).

-- 
M?ns Rullg?rd
mru at inprovide.com




More information about the ffmpeg-devel mailing list