History

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.

Jose Da Silva committed 5 years ago

Commit 8c3d31f1 parent 42c636c1 file · +5 −5Browse files

Unified · Split

libavcodec/xbmdec.c+5−5
@@ -28,12 +28,12 @@ · 27 unmodified lines
28 28
29static int convert(uint8_t x)29static int convert(uint8_t x)
30{30{
31 if (x >= 'a')31 if (x <= '9')
32 x -= 87;
33 else if (x >= 'A')
34 x -= 55;
35 else
36 x -= '0';32 x -= '0';
33 else if (x >= 'a')
34 x -= ('a' - 10);
35 else
36 x -= ('A' - 10);
37 return x;37 return x;
38}38}
39 39

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t