aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/xbmdec.c
diff options
context:
space:
mode:
authorJose Da Silva <digital@joescat.com>2021-01-31 19:51:04 -0800
committerPaul B Mahol <onemda@gmail.com>2021-02-03 16:03:15 +0100
commit8c3d31fbeee157d6f529402c86371c857026fcff (patch)
tree8c2771bd576265420e085ab84acc2e397f90d2d6 /libavcodec/xbmdec.c
parent42c636c9722f64fe6290ea8eee13658d25f5fbe3 (diff)
downloadffmpeg-8c3d31fbeee157d6f529402c86371c857026fcff.tar.gz
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>
Diffstat (limited to 'libavcodec/xbmdec.c')
-rw-r--r--libavcodec/xbmdec.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/xbmdec.c b/libavcodec/xbmdec.c
index b783d5abe5..52615dc7ab 100644
--- a/libavcodec/xbmdec.c
+++ b/libavcodec/xbmdec.c
@@ -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;
}