| 468 | } |
| 469 | |
| 470 | static NODISCARD bool dinibble2int(const char *buf, uint8_t *result) { |
| 471 | uint8_t result_val = 0; |
| 472 | for (int i = 0; i < 2; i++) { |
| 473 | char c = buf[i]; |
| 474 | result_val <<= 4; |
| 475 | if ('0' <= c && c <= '9') { |
| 476 | result_val += c - '0'; |
| 477 | } else if ('a' <= c && c <= 'f') { |
| 478 | result_val += 10 + (c - 'a'); |
| 479 | } else { |
| 480 | return false; |
| 481 | } |
| 482 | } |
| 483 | *result = result_val; |
| 484 | return true; |
| 485 | } |
| 486 | |
| 487 | |
| 488 | typedef enum { |
no outgoing calls
no test coverage detected