1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-29 22:00:58 +02:00

avcodec/xbmdec: convert() minor speed increase

If we test for {0..9} first, we have tested for 10/16th of all possible
characters first and avoid testing the remaining 6/16th of all possible
characters, which can be either 6/16th lowercase or 6/16th uppercase.

Signed-off-by: Joe Da Silva <digital@joescat.com>
This commit is contained in:
Jose Da Silva 2021-01-31 19:51:04 -08:00 committed by Paul B Mahol
parent 42c636c972
commit 8c3d31fbee

View File

@ -28,12 +28,12 @@
static int convert(uint8_t x)
{
if (x >= 'a')
x -= 87;
else if (x >= 'A')
x -= 55;
else
if (x <= '9')
x -= '0';
else if (x >= 'a')
x -= ('a' - 10);
else
x -= ('A' - 10);
return x;
}