MCPcopy Create free account
hub / github.com/ElementsProject/elements / SetHex

Method SetHex

src/uint256.cpp:37–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35
36template <unsigned int BITS>
37void base_blob<BITS>::SetHex(const char* psz)
38{
39 memset(m_data, 0, sizeof(m_data));
40
41 // skip leading spaces
42 while (IsSpace(*psz))
43 psz++;
44
45 // skip 0x
46 if (psz[0] == '0' && ToLower(psz[1]) == 'x')
47 psz += 2;
48
49 // hex string to uint
50 size_t digits = 0;
51 while (::HexDigit(psz[digits]) != -1)
52 digits++;
53 unsigned char* p1 = (unsigned char*)m_data;
54 unsigned char* pend = p1 + WIDTH;
55 while (digits > 0 && p1 < pend) {
56 *p1 = ::HexDigit(psz[--digits]);
57 if (digits > 0) {
58 *p1 |= ((unsigned char)::HexDigit(psz[--digits]) << 4);
59 p1++;
60 }
61 }
62}
63
64template <unsigned int BITS>
65void base_blob<BITS>::SetHex(const std::string& str)

Callers 15

rest_getutxosFunction · 0.45
MutateTxAddOutDataFunction · 0.45
UpdateFromArgsMethod · 0.45
CLiquidV1ParamsMethod · 0.45
UpdateFromArgsMethod · 0.45
ParseHashStrFunction · 0.45
uint256SFunction · 0.45
dumpissuanceblindingkeyFunction · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45
uint160SFunction · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45

Calls 3

IsSpaceFunction · 0.85
HexDigitFunction · 0.85
ToLowerFunction · 0.50

Tested by 5

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