avcodec/xpmdec: avoid "magic" numbers in function hex_char_to_number()
authorPaul B Mahol <onemda@gmail.com>
Sun, 12 Mar 2017 21:58:49 +0000 (22:58 +0100)
committerPaul B Mahol <onemda@gmail.com>
Sun, 12 Mar 2017 22:03:02 +0000 (23:03 +0100)
Signed-off-by: Paul B Mahol <onemda@gmail.com>
libavcodec/xpmdec.c

index b9b2551..605a09d 100644 (file)
@@ -188,9 +188,9 @@ static const ColorEntry color_table[] = {
 static unsigned hex_char_to_number(uint8_t x)
 {
     if (x >= 'a' && x <= 'f')
-        x -= 87;
+        x -= 'a' - 10;
     else if (x >= 'A' && x <= 'F')
-        x -= 55;
+        x -= 'A' - 10;
     else if (x >= '0' && x <= '9')
         x -= '0';
     else