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
2828
2929 static int convert(uint8_t x)
3030 {
31− if (x >= 'a')
32− x -= 87;
33− else if (x >= 'A')
34− x -= 55;
35− else
31+ if (x <= '9')
3632 x -= '0';
33+ else if (x >= 'a')
34+ x -= ('a' - 10);
35+ else
36+ x -= ('A' - 10);
3737 return x;
3838 }
3939

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