1
0
Fork 0
mirror of https://github.com/hermitcore/libhermit.git synced 2025-03-09 00:00:03 +01:00

add basic support of isxdigit

This commit is contained in:
Stefan Lankes 2017-09-03 10:48:22 +02:00
parent cbb34022a0
commit 34c6fb83ef

View file

@ -144,6 +144,23 @@ static inline int atoi(const char *str)
return (int)_strtol(str, (char **)NULL, 10);
}
/** @brief Checks whether c is a hexdecimal digit character.
*
* @return A value different from zero if indeed c is a hexadecimal digit.
* Zero otherwise.
*/
static inline int isxdigit(int c)
{
if ((c >= '0') && (c <= '9'))
return 1;
else if ((c >= 'A') && (c <= 'F'))
return 1;
else if ((c >= 'a') && (c <= 'f'))
return 1;
return 0;
}
#ifdef __cplusplus
}
#endif