[FFmpeg-devel] [PATCH] Yet more ALAC cleanup (#define removal)

Vitor Sessak vitor1001
Wed Aug 15 20:50:05 CEST 2007


Hi

Reimar D?ffinger wrote:
> Hello,
> On Wed, Aug 15, 2007 at 08:22:59PM +0200, Vitor Sessak wrote:
>> -#define SIGN_ONLY(v) \
>> -                     ((v < 0) ? (-1) : \
>> -                                ((v > 0) ? (1) : \
>> -                                           (0)))
>> +static inline int sign_only(int v)
>> +{
>> +    if (v < 0)
>> +        return -1;
>> +    else if (v > 0)
>> +        return 1;
>> +    else
>> +        return 0;
>> +}
> 
> Since you change it anyway, I'd suggest
> if (v == 0) return 0;
> return FFSIGN(v);
> 
> Though benchmarking it might be a good idea unless it is really
> uncritical.
> 
> Greetings,
> Reimar D?ffinger

Nice suggestion, but I don't think it is worth benchmarking. Unless the 
compiler is very stupid, all this should generate the same asm. New 
patch attached.

-Vitor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alac9_2.diff
Type: text/x-patch
Size: 2836 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070815/9d9b43a9/attachment.bin>



More information about the ffmpeg-devel mailing list