Lines Matching +full:2 +full:x
12 int char2hex(char c, uint8_t *x) in char2hex() argument
15 *x = c - '0'; in char2hex()
17 *x = c - 'a' + 10; in char2hex()
19 *x = c - 'A' + 10; in char2hex()
27 int hex2char(uint8_t x, char *c) in hex2char() argument
29 if (x <= 9) { in hex2char()
30 *c = x + (char)'0'; in hex2char()
31 } else if (x <= 15) { in hex2char()
32 *c = x - 10 + (char)'a'; in hex2char()
42 if (hexlen < ((buflen * 2U) + 1U)) { in bin2hex()
47 if (hex2char(buf[i] >> 4, &hex[2U * i]) < 0) { in bin2hex()
50 if (hex2char(buf[i] & 0xf, &hex[2U * i + 1U]) < 0) { in bin2hex()
55 hex[2U * buflen] = '\0'; in bin2hex()
56 return 2U * buflen; in bin2hex()
63 if (buflen < (hexlen / 2U + hexlen % 2U)) { in hex2bin()
68 if ((hexlen % 2U) != 0) { in hex2bin()
78 for (size_t i = 0; i < (hexlen / 2U); i++) { in hex2bin()
79 if (char2hex(hex[2U * i], &dec) < 0) { in hex2bin()
84 if (char2hex(hex[2U * i + 1U], &dec) < 0) { in hex2bin()
90 return hexlen / 2U + hexlen % 2U; in hex2bin()