We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e74649e commit 0f459d8Copy full SHA for 0f459d8
src/uint256.cpp
@@ -37,16 +37,15 @@ void base_blob<BITS>::SetHex(const char* psz)
37
psz += 2;
38
39
// hex string to uint
40
- const char* pbegin = psz;
41
- while (::HexDigit(*psz) != -1)
42
- psz++;
43
- psz--;
+ size_t digits = 0;
+ while (::HexDigit(psz[digits]) != -1)
+ digits++;
44
unsigned char* p1 = (unsigned char*)data;
45
unsigned char* pend = p1 + WIDTH;
46
- while (psz >= pbegin && p1 < pend) {
47
- *p1 = ::HexDigit(*psz--);
48
- if (psz >= pbegin) {
49
- *p1 |= ((unsigned char)::HexDigit(*psz--) << 4);
+ while (digits > 0 && p1 < pend) {
+ *p1 = ::HexDigit(psz[--digits]);
+ if (digits > 0) {
+ *p1 |= ((unsigned char)::HexDigit(psz[--digits]) << 4);
50
p1++;
51
}
52
0 commit comments