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

Nicolas George george at nsup.org
Wed Jul 28 11:06:09 EEST 2021


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>.

> > +    if (ff_between('0', '9', c))
> 
> 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.


Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20210728/679bb309/attachment.sig>


More information about the ffmpeg-devel mailing list