@@ -146,13 +146,21 @@ double base_uint<BITS>::getdouble() const
146146template <unsigned int BITS>
147147std::string base_uint<BITS>::GetHex() const
148148{
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 ();
150154}
151155
152156template <unsigned int BITS>
153157void base_uint<BITS>::SetHex(const char * psz)
154158{
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+ }
156164}
157165
158166template <unsigned int BITS>
@@ -164,7 +172,7 @@ void base_uint<BITS>::SetHex(const std::string& str)
164172template <unsigned int BITS>
165173std::string base_uint<BITS>::ToString() const
166174{
167- return ( GetHex () );
175+ return GetHex ();
168176}
169177
170178template <unsigned int BITS>
@@ -183,20 +191,7 @@ unsigned int base_uint<BITS>::bits() const
183191}
184192
185193// 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 >;
200195
201196// This implementation directly uses shifts instead of going
202197// through an intermediate MPI representation.
0 commit comments