[FFmpeg-devel] [PATCH] Remove MULL macro from lsp.c

Måns Rullgård mans
Tue Aug 26 21:22:58 CEST 2008


Loren Merritt <lorenm at u.washington.edu> writes:

> On Tue, 26 Aug 2008, M?ns Rullg?rd wrote:
>
>> "Vladimir Voroshilov" <voroshil at gmail.com> writes:
>>
>>> Please look into attached patch and tell what chunks are ok.
>>> I used (and tested) only MULL macro but others (due to used "l"
>>> suffix) can have the same bug.
>>> Unfortunately, i'm not know asm enough good to be sure.
>>>
>>> Index: libavcodec/i386/mathops.h
>>> ===================================================================
>>> --- libavcodec/i386/mathops.h	(revision 14975)
>>> +++ libavcodec/i386/mathops.h	(working copy)
>>> @@ -28,18 +28,18 @@
>>>              "imull %3               \n\t"\
>>>              "shrdl %4, %%edx, %%eax \n\t"\
>>>              : "=a"(rt), "=d"(dummy)\
>>> -            : "a" (ra), "rm" (rb), "i"(FRAC_BITS));\
>>> +            : "a" ((int)ra), "rm" ((int)rb), "i"(FRAC_BITS));\
>>>           rt; })
>>
>> I think only the potential memory operands need the cast.  Here it
>> would be the "rb" parameter.
>
> ra needs to be sign-extended too.
> gcc defaults to zero-extend when loading 16bit values from memory. Or
> if it's computed, then the msbs will be junk.

What a twisted compiler.  Thanks for the correction, anyway.  I should
know better than to speak about x86.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list