summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2017-03-27 14:50:36 +0100
committerMichael Drake <michael.drake@codethink.co.uk>2017-03-27 14:50:36 +0100
commit3ec522429ae933a3035c854aa78d136a06dee0db (patch)
tree300cf6c6dce609aae1c23ab4f119d5bb6abfcfe1
parent04d74a79ae95514af73476dafbdaea3a19e54b34 (diff)
downloadnetsurf-3ec522429ae933a3035c854aa78d136a06dee0db.tar.gz
netsurf-3ec522429ae933a3035c854aa78d136a06dee0db.tar.bz2
ASCII: Split out A-F test.
-rw-r--r--utils/ascii.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/utils/ascii.h b/utils/ascii.h
index f08e756a0..55ca89ca2 100644
--- a/utils/ascii.h
+++ b/utils/ascii.h
@@ -123,6 +123,17 @@ static inline bool ascii_is_hex_lower(char c)
}
/**
+ * Test whether a character is 'A' to 'F' (uppercase).
+ *
+ * \param[in] c Character to test.
+ * \return true iff `c` is 'A' to 'F' (uppercase), else false.
+ */
+static inline bool ascii_is_af_upper(char c)
+{
+ return (c >= 'A' && c <= 'F');
+}
+
+/**
* Test whether a character is hexadecimal (upper case).
*
* \param[in] c Character to test.
@@ -130,8 +141,7 @@ static inline bool ascii_is_hex_lower(char c)
*/
static inline bool ascii_is_hex_upper(char c)
{
- return (ascii_is_digit(c) ||
- (c >= 'A' && c <= 'F'));
+ return (ascii_is_digit(c) || ascii_is_af_upper(c));
}
/**
@@ -143,7 +153,7 @@ static inline bool ascii_is_hex_upper(char c)
static inline bool ascii_is_hex(char c)
{
return (ascii_is_digit(c) ||
- (c >= 'A' && c <= 'F') ||
+ ascii_is_af_upper(c) ||
(c >= 'a' && c <= 'f'));
}