[FFmpeg-devel] [PATCH] avutil/ripemd: make rol macro more robust by adding parentheses

Ganesh Ajjanagadde gajjanag at mit.edu
Thu Oct 29 02:43:53 CET 2015


On Wed, Oct 28, 2015 at 11:52 AM, James Almer <jamrial at gmail.com> wrote:
> On 10/27/2015 9:00 PM, Ganesh Ajjanagadde wrote:
>> This ensures that the macro remains correct in the sense of allowing
>> expressions for value and bits, by placing the value and bits expressions within
>> parentheses.
>>
>> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
>> ---
>>  libavutil/ripemd.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavutil/ripemd.c b/libavutil/ripemd.c
>> index d247fb4..6777c99 100644
>> --- a/libavutil/ripemd.c
>> +++ b/libavutil/ripemd.c
>> @@ -85,7 +85,7 @@ static const int WB[80] = {
>>      12, 15, 10,  4,  1,  5,  8,  7,  6,  2, 13, 14,  0,  3,  9, 11
>>  };
>>
>> -#define rol(value, bits) ((value << bits) | (value >> (32 - bits)))
>> +#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
>>
>>  #define ROUND128_0_TO_15(a,b,c,d,e,f,g,h)                               \
>>      a = rol(a + ((  b ^ c  ^ d)      + block[WA[n]]),         ROTA[n]); \
>>
>
> LGTM

pushed, thanks.

>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


More information about the ffmpeg-devel mailing list