ASCII: Split out a-f test.

This commit is contained in:
Michael Drake 2017-03-27 14:57:11 +01:00
parent 3ec522429a
commit 8caae83d35
1 changed files with 13 additions and 3 deletions

View File

@ -110,6 +110,17 @@ static inline bool ascii_is_alphanumerical(char c)
return (ascii_is_alpha(c) || ascii_is_digit(c));
}
/**
* Test whether a character is 'a' to 'f' (lowercase).
*
* \param[in] c Character to test.
* \return true iff `c` is 'a' to 'f' (lowercase), else false.
*/
static inline bool ascii_is_af_lower(char c)
{
return (c >= 'a' && c <= 'f');
}
/**
* Test whether a character is hexadecimal (lower case).
*
@ -118,8 +129,7 @@ static inline bool ascii_is_alphanumerical(char c)
*/
static inline bool ascii_is_hex_lower(char c)
{
return (ascii_is_digit(c) ||
(c >= 'a' && c <= 'f'));
return (ascii_is_digit(c) || ascii_is_af_lower(c));
}
/**
@ -154,7 +164,7 @@ static inline bool ascii_is_hex(char c)
{
return (ascii_is_digit(c) ||
ascii_is_af_upper(c) ||
(c >= 'a' && c <= 'f'));
ascii_is_af_lower(c));
}
/**