Merge pull request #3076 from lano1106/uint256_util
Make util phexdigit array reusable
This commit is contained in:
@@ -347,13 +347,13 @@ public:
|
||||
psz++;
|
||||
|
||||
// hex string to bignum
|
||||
static const signed char phexdigit[256] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0, 0,0xa,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0xa,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0,0,0,0,0 };
|
||||
*this = 0;
|
||||
while (isxdigit(*psz))
|
||||
int n;
|
||||
while ((n = HexDigit(*psz)) != -1)
|
||||
{
|
||||
*this <<= 4;
|
||||
int n = phexdigit[(unsigned char)*psz++];
|
||||
*this += n;
|
||||
++psz;
|
||||
}
|
||||
if (fNegative)
|
||||
*this = 0 - *this;
|
||||
|
||||
Reference in New Issue
Block a user