@@ -313,58 +313,6 @@ type rtype struct {
313
313
t abi.Type
314
314
}
315
315
316
- // OverflowComplex reports whether the complex128 x cannot be represented by type t.
317
- // It panics if t's Kind is not Complex64 or Complex128.
318
- func (t * rtype ) OverflowComplex (x complex128 ) bool {
319
- k := t .Kind ()
320
- switch k {
321
- case Complex64 :
322
- return overflowFloat32 (real (x )) || overflowFloat32 (imag (x ))
323
- case Complex128 :
324
- return false
325
- }
326
- panic ("reflect: OverflowComplex of non-complex type " + t .String ())
327
- }
328
-
329
- // OverflowFloat reports whether the float64 x cannot be represented by type t.
330
- // It panics if t's Kind is not Float32 or Float64.
331
- func (t * rtype ) OverflowFloat (x float64 ) bool {
332
- k := t .Kind ()
333
- switch k {
334
- case Float32 :
335
- return overflowFloat32 (x )
336
- case Float64 :
337
- return false
338
- }
339
- panic ("reflect: OverflowFloat of non-float type " + t .String ())
340
- }
341
-
342
- // OverflowInt reports whether the int64 x cannot be represented by type t.
343
- // It panics if t's Kind is not Int, Int8, Int16, Int32, or Int64.
344
- func (t * rtype ) OverflowInt (x int64 ) bool {
345
- k := t .Kind ()
346
- switch k {
347
- case Int , Int8 , Int16 , Int32 , Int64 :
348
- bitSize := t .Size () * 8
349
- trunc := (x << (64 - bitSize )) >> (64 - bitSize )
350
- return x != trunc
351
- }
352
- panic ("reflect: OverflowInt of non-int type " + t .String ())
353
- }
354
-
355
- // OverflowUint reports whether the uint64 x cannot be represented by type t.
356
- // It panics if t's Kind is not Uint, Uintptr, Uint8, Uint16, Uint32, or Uint64.
357
- func (t * rtype ) OverflowUint (x uint64 ) bool {
358
- k := t .Kind ()
359
- switch k {
360
- case Uint , Uintptr , Uint8 , Uint16 , Uint32 , Uint64 :
361
- bitSize := t .Size () * 8
362
- trunc := (x << (64 - bitSize )) >> (64 - bitSize )
363
- return x != trunc
364
- }
365
- panic ("reflect: OverflowUint of non-uint type " + t .String ())
366
- }
367
-
368
316
func (t * rtype ) common () * abi.Type {
369
317
return & t .t
370
318
}
@@ -880,6 +828,50 @@ func (t *rtype) IsVariadic() bool {
880
828
return tt .IsVariadic ()
881
829
}
882
830
831
+ func (t * rtype ) OverflowComplex (x complex128 ) bool {
832
+ k := t .Kind ()
833
+ switch k {
834
+ case Complex64 :
835
+ return overflowFloat32 (real (x )) || overflowFloat32 (imag (x ))
836
+ case Complex128 :
837
+ return false
838
+ }
839
+ panic ("reflect: OverflowComplex of non-complex type " + t .String ())
840
+ }
841
+
842
+ func (t * rtype ) OverflowFloat (x float64 ) bool {
843
+ k := t .Kind ()
844
+ switch k {
845
+ case Float32 :
846
+ return overflowFloat32 (x )
847
+ case Float64 :
848
+ return false
849
+ }
850
+ panic ("reflect: OverflowFloat of non-float type " + t .String ())
851
+ }
852
+
853
+ func (t * rtype ) OverflowInt (x int64 ) bool {
854
+ k := t .Kind ()
855
+ switch k {
856
+ case Int , Int8 , Int16 , Int32 , Int64 :
857
+ bitSize := t .Size () * 8
858
+ trunc := (x << (64 - bitSize )) >> (64 - bitSize )
859
+ return x != trunc
860
+ }
861
+ panic ("reflect: OverflowInt of non-int type " + t .String ())
862
+ }
863
+
864
+ func (t * rtype ) OverflowUint (x uint64 ) bool {
865
+ k := t .Kind ()
866
+ switch k {
867
+ case Uint , Uintptr , Uint8 , Uint16 , Uint32 , Uint64 :
868
+ bitSize := t .Size () * 8
869
+ trunc := (x << (64 - bitSize )) >> (64 - bitSize )
870
+ return x != trunc
871
+ }
872
+ panic ("reflect: OverflowUint of non-uint type " + t .String ())
873
+ }
874
+
883
875
// add returns p+x.
884
876
//
885
877
// The whySafe string is ignored, so that the function still inlines
0 commit comments