\return The integer equivalent to \a c. \retval -1 The character \a c is not a hex character.
| 19 | //! \return The integer equivalent to \a c. |
| 20 | //! \retval -1 The character \a c is not a hex character. |
| 21 | uint8_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 | //! |
no outgoing calls
no test coverage detected