MCPcopy Create free account
hub / github.com/GothenburgBitFactory/taskwarrior / hexToInt

Method hexToInt

src/Lexer.cpp:244–251  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////////// Converts '0' -> 0 '9' -> 9 'a'/'A' -> 10 'f'/'F' -> 15

Source from the content-addressed store, hash-verified

242// 'a'/'A' -> 10
243// 'f'/'F' -> 15
244int Lexer::hexToInt(int c) {
245 if (c >= '0' && c <= '9')
246 return (c - '0');
247 else if (c >= 'a' && c <= 'f')
248 return (c - 'a' + 10);
249 else
250 return (c - 'A' + 10);
251}
252
253////////////////////////////////////////////////////////////////////////////////
254int Lexer::hexToInt(int c0, int c1) { return (hexToInt(c0) << 4) + hexToInt(c1); }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected