Added method to convert hex-char to hex-value
This commit is contained in:
parent
9301c4e0fd
commit
8ef6318a56
@ -17,4 +17,18 @@ std::vector<std::string> split(const std::string& s, char delimiter)
|
||||
return tokens;
|
||||
}
|
||||
|
||||
char hex_char_to_int( char c ) {
|
||||
unsigned result = -1;
|
||||
if( ('0' <= c) && (c <= '9') ) {
|
||||
result = c - '0';
|
||||
}
|
||||
else if( ('A' <= c) && (c <= 'F') ) {
|
||||
result = 10 + c - 'A';
|
||||
}
|
||||
else if( ('a' <= c) && (c <= 'f') ) {
|
||||
result = 10 + c - 'a';
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif /* F7CFE6A7_34BF_4E04_94CF_DB8374980631 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user