Changeset View
Changeset View
Standalone View
Standalone View
src/arith_uint256.cpp
Show First 20 Lines • Show All 145 Lines • ▼ Show 20 Lines | |||||
template <unsigned int BITS> std::string base_uint<BITS>::ToString() const { | template <unsigned int BITS> std::string base_uint<BITS>::ToString() const { | ||||
return (GetHex()); | return (GetHex()); | ||||
} | } | ||||
template <unsigned int BITS> unsigned int base_uint<BITS>::bits() const { | template <unsigned int BITS> unsigned int base_uint<BITS>::bits() const { | ||||
for (int pos = WIDTH - 1; pos >= 0; pos--) { | for (int pos = WIDTH - 1; pos >= 0; pos--) { | ||||
if (pn[pos]) { | if (pn[pos]) { | ||||
for (int bits = 31; bits > 0; bits--) { | for (int nbits = 31; nbits > 0; nbits--) { | ||||
if (pn[pos] & 1 << bits) return 32 * pos + bits + 1; | if (pn[pos] & 1 << nbits) { | ||||
return 32 * pos + nbits + 1; | |||||
} | |||||
} | } | ||||
return 32 * pos + 1; | return 32 * pos + 1; | ||||
} | } | ||||
} | } | ||||
return 0; | return 0; | ||||
} | } | ||||
// Explicit instantiations for base_uint<256> | // Explicit instantiations for base_uint<256> | ||||
▲ Show 20 Lines • Show All 71 Lines • Show Last 20 Lines |