File tree Expand file tree Collapse file tree 2 files changed +13
-13
lines changed Expand file tree Collapse file tree 2 files changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -97,30 +97,26 @@ func (x *BigInt) MaybeInt() Object {
9797 return i
9898}
9999
100- // Truncates to go int64
100+ // Truncates to go int
101101//
102- // If it is outside the range of an go int64 it will return an error
103- func (x * BigInt ) GoInt () (int64 , error ) {
102+ // If it is outside the range of an go int it will return an error
103+ func (x * BigInt ) GoInt () (int , error ) {
104104 z , err := x .Int ()
105105 if err != nil {
106106 return 0 , err
107107 }
108- return int64 ( z ), nil
108+ return z . GoInt ()
109109}
110110
111- // Truncates to go int
111+ // Truncates to go int64
112112//
113- // If it is outside the range of an go int it will return an error
114- func (x * BigInt ) GoInt64 () (int , error ) {
113+ // If it is outside the range of an go int64 it will return an error
114+ func (x * BigInt ) GoInt64 () (int64 , error ) {
115115 z , err := x .Int ()
116116 if err != nil {
117- return 0 , overflowErrorGo
118- }
119- r := int (z )
120- if Int (r ) != z {
121- return 0 , overflowErrorGo
117+ return 0 , err
122118 }
123- return int ( r ), nil
119+ return int64 ( z ), nil
124120}
125121
126122// Frexp produces frac and exp such that a ~= frac × 2**exp
@@ -589,3 +585,5 @@ var _ conversionBetweenTypes = (*BigInt)(nil)
589585var _ I__bool__ = (* BigInt )(nil )
590586var _ I__index__ = (* BigInt )(nil )
591587var _ richComparison = (* BigInt )(nil )
588+ var _ IGoInt = (* BigInt )(nil )
589+ var _ IGoInt64 = (* BigInt )(nil )
Original file line number Diff line number Diff line change @@ -712,3 +712,5 @@ var _ conversionBetweenTypes = Int(0)
712712var _ I__bool__ = Int (0 )
713713var _ I__index__ = Int (0 )
714714var _ richComparison = Int (0 )
715+ var _ IGoInt = Int (0 )
716+ var _ IGoInt64 = Int (0 )
You can’t perform that action at this time.
0 commit comments