[FFmpeg-devel] [PATCH 01/10] lavu/internal: add hex to int functions.

Marton Balint cus at passwd.hu
Wed Jul 28 21:07:33 EEST 2021



On Wed, 28 Jul 2021, Nicolas George wrote:

> Marton Balint (12021-07-27):
>>> +static inline int ff_between(unsigned min, unsigned max, unsigned val)
>>> +{
>>> +    return val - min <= max - min;
>>> +}
>> This seems a bit too general. What if somebody needs int and not unsigned? I
>
> Any type smaller than unsigned will be promoted to unsigned, which is
> exactly what needs to happen. It will not work for larger types, and I
> think it is ok; the C standard does the same: abs() does not work for
> int64_t.
>
>> just think it is better to not make this ff_*.
>
> We cannot hide a static inline function. If you really insist, I can
> make it a macro and #undef it later, but <PUKE EMOJI>.

No, fine as is, can be changed later if needed.

>>
>> av_isdigit(c)
>>
>>> +        return c - '0';
>>> +    c &= ~('a' - 'A');
>>
>> c = av_toupper(c);
>
> That would require including avstring.h from internal.h. I do not think
> these simple functions are worth it.

Then maybe add the function to avstring.h? c &= ~('a' - 'A') is anything 
but readable, at least add a comment if you don't like avstring.h.

Thanks,
Marton


More information about the ffmpeg-devel mailing list