mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -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
|
||||
is_valid(char c)
|
||||
is_valid(unsigned char c)
|
||||
{
|
||||
return ((c >= 'A' && c <= 'Z') ||
|
||||
(c >= 'a' && c <= 'z') ||
|
||||
(c >= '0' && c <= '9') ||
|
||||
c == '+' || c == '/' || c == '=');
|
||||
return reverse_lookup[c] != 0 || c == 'A' || c == '=';
|
||||
}
|
||||
|
||||
char *
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue