MCPcopy Create free account
hub / github.com/EmbeddedRPC/erpc / hexCharToInt

Function hexCharToInt

erpcgen/src/HexValues.cpp:21–39  ·  view source on GitHub ↗

\return The integer equivalent to \a c. \retval -1 The character \a c is not a hex character.

Source from the content-addressed store, hash-verified

19//! \return The integer equivalent to \a c.
20//! \retval -1 The character \a c is not a hex character.
21uint8_t hexCharToInt(char c)
22{
23 if (c >= '0' && c <= '9')
24 {
25 return c - '0';
26 }
27 else if (c >= 'a' && c <= 'f')
28 {
29 return c - 'a' + 10;
30 }
31 else if (c >= 'A' && c <= 'F')
32 {
33 return c - 'A' + 10;
34 }
35 else
36 {
37 return static_cast<uint8_t>(-1);
38 }
39}
40
41//! \param encodedByte Must point to at least two ASCII hex characters.
42//!

Callers 2

processStringEscapesMethod · 0.85
hexByteToIntFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected