mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-06-27 11:21:32 +00:00
Micro-optimization
This commit is contained in:
parent
d519b0767b
commit
cbadeb5e9a
1 changed files with 7 additions and 3 deletions
|
|
@ -781,9 +781,13 @@ contrast(Color* self, PyObject *o) {
|
|||
|
||||
static int
|
||||
hexchar_to_int(char c) {
|
||||
if ('0' <= c && c <= '9') return c - '0';
|
||||
if ('a' <= c && c <= 'f') return c - 'a' + 10;
|
||||
if ('A' <= c && c <= 'F') return c - 'A' + 10;
|
||||
switch (c) {
|
||||
START_ALLOW_CASE_RANGE
|
||||
case '0' ... '9': return c - '0';
|
||||
case 'a' ... 'f': return c - 'a' + 10;
|
||||
case 'A' ... 'F': return c - 'A' + 10;
|
||||
END_ALLOW_CASE_RANGE
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue