File tree Expand file tree Collapse file tree 1 file changed +5
-16
lines changed
Expand file tree Collapse file tree 1 file changed +5
-16
lines changed Original file line number Diff line number Diff line change @@ -1199,28 +1199,17 @@ class basic_bigint
11991199 return get_storage_view ().size () != 0 ? true : false ;
12001200 }
12011201
1202- explicit operator int64_t () const
1202+ template <typename Integer, typename = typename std::enable_if<std::is_integral<Integer>::value && sizeof (Integer) <= sizeof (int64_t )>::type>
1203+ explicit operator Integer () const
12031204 {
12041205 auto this_view = get_storage_view ();
1205- int64_t x = 0 ;
1206+ Integer x = 0 ;
12061207 if (this_view.size () > 0 )
12071208 {
1208- x = static_cast <int64_t >(this_view[0 ]);
1209+ x = static_cast <Integer >(this_view[0 ]);
12091210 }
12101211
1211- return is_negative () ? -x : x;
1212- }
1213-
1214- explicit operator word_type () const
1215- {
1216- auto this_view = get_storage_view ();
1217- word_type u = 0 ;
1218- if ( this_view.size () > 0 )
1219- {
1220- u = this_view[0 ];
1221- }
1222-
1223- return u;
1212+ return is_negative () ? x*(-1 ) : x;
12241213 }
12251214
12261215 explicit operator double () const
You can’t perform that action at this time.
0 commit comments