@@ -146,13 +146,21 @@ double base_uint<BITS>::getdouble() const
146
146
template <unsigned int BITS>
147
147
std::string base_uint<BITS>::GetHex() const
148
148
{
149
- return ArithToUint256 (*this ).GetHex ();
149
+ base_blob<BITS> b;
150
+ for (int x = 0 ; x < this ->WIDTH ; ++x) {
151
+ WriteLE32 (b.begin () + x*4 , this ->pn [x]);
152
+ }
153
+ return b.GetHex ();
150
154
}
151
155
152
156
template <unsigned int BITS>
153
157
void base_uint<BITS>::SetHex(const char * psz)
154
158
{
155
- *this = UintToArith256 (uint256S (psz));
159
+ base_blob<BITS> b;
160
+ b.SetHex (psz);
161
+ for (int x = 0 ; x < this ->WIDTH ; ++x) {
162
+ this ->pn [x] = ReadLE32 (b.begin () + x*4 );
163
+ }
156
164
}
157
165
158
166
template <unsigned int BITS>
@@ -164,7 +172,7 @@ void base_uint<BITS>::SetHex(const std::string& str)
164
172
template <unsigned int BITS>
165
173
std::string base_uint<BITS>::ToString() const
166
174
{
167
- return ( GetHex () );
175
+ return GetHex ();
168
176
}
169
177
170
178
template <unsigned int BITS>
@@ -183,20 +191,7 @@ unsigned int base_uint<BITS>::bits() const
183
191
}
184
192
185
193
// Explicit instantiations for base_uint<256>
186
- template base_uint<256 >::base_uint(const std::string&);
187
- template base_uint<256 >& base_uint<256 >::operator <<=(unsigned int );
188
- template base_uint<256 >& base_uint<256 >::operator >>=(unsigned int );
189
- template base_uint<256 >& base_uint<256 >::operator *=(uint32_t b32);
190
- template base_uint<256 >& base_uint<256 >::operator *=(const base_uint<256 >& b);
191
- template base_uint<256 >& base_uint<256 >::operator /=(const base_uint<256 >& b);
192
- template int base_uint<256 >::CompareTo(const base_uint<256 >&) const ;
193
- template bool base_uint<256 >::EqualTo(uint64_t ) const ;
194
- template double base_uint<256 >::getdouble() const ;
195
- template std::string base_uint<256 >::GetHex() const ;
196
- template std::string base_uint<256 >::ToString() const ;
197
- template void base_uint<256 >::SetHex(const char *);
198
- template void base_uint<256 >::SetHex(const std::string&);
199
- template unsigned int base_uint<256 >::bits() const ;
194
+ template class base_uint <256 >;
200
195
201
196
// This implementation directly uses shifts instead of going
202
197
// through an intermediate MPI representation.
0 commit comments