MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / SetHex

Method SetHex

src/uint256.cpp:27–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25
26template <unsigned int BITS>
27void base_blob<BITS>::SetHex(const char* psz)
28{
29 memset(data, 0, sizeof(data));
30
31 // skip leading spaces
32 while (isspace(*psz))
33 psz++;
34
35 // skip 0x
36 if (psz[0] == '0' && tolower(psz[1]) == 'x')
37 psz += 2;
38
39 // hex string to uint
40 const char* pbegin = psz;
41 while (::HexDigit(*psz) != -1)
42 psz++;
43 psz--;
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);
50 p1++;
51 }
52 }
53}
54
55template <unsigned int BITS>
56void base_blob<BITS>::SetHex(const std::string& str)

Callers 15

ParseHashStrFunction · 0.45
rest_getutxosFunction · 0.45
ParseHashStrFunction · 0.45
uint256SFunction · 0.45
listsinceblockFunction · 0.45
gettransactionFunction · 0.45
abandontransactionFunction · 0.45
bumpfeeFunction · 0.45
removeprunedfundsFunction · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45
uint160SFunction · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45

Calls 1

HexDigitFunction · 0.85

Tested by 4

BOOST_AUTO_TEST_CASEFunction · 0.36
uint160SFunction · 0.36
BOOST_AUTO_TEST_CASEFunction · 0.36
BOOST_AUTO_TEST_CASEFunction · 0.36