mdbx-tools: преобразование из hex без переходов в mdbx_load.

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2024-05-15 00:09:58 +03:00
parent 12eb2df57d
commit 2f66eb9fec

View File

@ -369,16 +369,15 @@ static int badend(void) {
} }
static inline int unhex(unsigned char *c2) { static inline int unhex(unsigned char *c2) {
int x, c; int8_t hi = c2[0];
x = *c2++ & 0x4f; hi = (hi | 0x20) - 'a';
if (x & 0x40) hi += 10 + ((hi >> 7) & 39);
x -= 55;
c = x << 4; int8_t lo = c2[1];
x = *c2 & 0x4f; lo = (lo | 0x20) - 'a';
if (x & 0x40) lo += 10 + ((lo >> 7) & 39);
x -= 55;
c |= x; return hi << 4 | lo;
return c;
} }
__hot static int readline(MDBX_val *out, MDBX_val *buf) { __hot static int readline(MDBX_val *out, MDBX_val *buf) {