[FFmpeg-devel] [PATCH] lavu/libm: add isfinite fallback

Ganesh Ajjanagadde gajjanag at mit.edu
Thu Jan 14 02:14:09 CET 2016


On Wed, Jan 13, 2016 at 8:11 PM, James Almer <jamrial at gmail.com> wrote:
> On 1/13/2016 9:48 PM, Ganesh Ajjanagadde wrote:
>> On Wed, Jan 13, 2016 at 7:39 PM, Ronald S. Bultje <rsbultje at gmail.com> wrote:
>>> Hi,
>>>
>>> On Wed, Jan 13, 2016 at 7:10 PM, Ganesh Ajjanagadde <gajjanagadde at gmail.com>
>>> wrote:
>>>>
>>>> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
>>>> ---
>>>>  configure        | 1 +
>>>>  libavutil/libm.h | 4 ++++
>>>>  2 files changed, 5 insertions(+)
>>>>
>>>> diff --git a/configure b/configure
>>>> index 415d939..a3aaa25 100755
>>>> --- a/configure
>>>> +++ b/configure
>>>> @@ -1821,6 +1821,7 @@ MATH_FUNCS="
>>>>      exp2f
>>>>      expf
>>>>      hypot
>>>> +    isfinite
>>>>      isinf
>>>>      isnan
>>>>      ldexpf
>>>> diff --git a/libavutil/libm.h b/libavutil/libm.h
>>>> index bc44dca..f01e5c6 100644
>>>> --- a/libavutil/libm.h
>>>> +++ b/libavutil/libm.h
>>>> @@ -343,6 +343,10 @@ static av_always_inline av_const int
>>>> avpriv_isnan(double x)
>>>>          : avpriv_isnan(x))
>>>>  #endif /* HAVE_ISNAN */
>>>>
>>>> +#if !HAVE_ISFINITE
>>>> +#define isfinite(x) (!(isinf(x) || isnan(x)))
>>>> +#endif /* HAVE_ISFINITE */
>>>
>>>
>>> This will break if you use isfinite(*ptr++) or something obscure like that.
>>
>> isfinite is a macro, not a function (man isfinite). Your point is
>> still valid though, really it should do a sizeof first (dbl/float),
>> then call a avpriv_isfinitef, avpriv_isfinite. I was being lazy.
>>
>>> I'd make it an inline function. Otherwise I think it's fine.
>>
>> Changed locally.
>
> Please, when you're going to rewrite the entire patch into something completely
> different then send the new version to the ml. "Changed locally" is acceptable
> for small changes, not full rewrites.

Judged it to be simple enough, especially since it mirrors
isnan/isinf. Sorry, will be more cautious in the future.

>
> You pushed a patch Ronald didn't ever review, saying he reviewed it. That's not
> a good practice.
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


More information about the ffmpeg-devel mailing list