mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
base64: simplify is_valid() by using reverse_lookup table
This commit is contained in:
parent
42ba135dcb
commit
745aeba382
1 changed files with 2 additions and 5 deletions
7
base64.c
7
base64.c
|
|
@ -37,12 +37,9 @@ static const char lookup[64] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
is_valid(char c)
|
is_valid(unsigned char c)
|
||||||
{
|
{
|
||||||
return ((c >= 'A' && c <= 'Z') ||
|
return reverse_lookup[c] != 0 || c == 'A' || c == '=';
|
||||||
(c >= 'a' && c <= 'z') ||
|
|
||||||
(c >= '0' && c <= '9') ||
|
|
||||||
c == '+' || c == '/' || c == '=');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue