Skip to content

Commit acdc6ad

Browse files
committed
move to exported area
1 parent 8d8e1e2 commit acdc6ad

File tree

1 file changed

+44
-44
lines changed

1 file changed

+44
-44
lines changed

src/reflect/type.go

+44-44
Original file line numberDiff line numberDiff line change
@@ -313,50 +313,6 @@ type rtype struct {
313313
t abi.Type
314314
}
315315

316-
func (t *rtype) OverflowComplex(x complex128) bool {
317-
k := t.Kind()
318-
switch k {
319-
case Complex64:
320-
return overflowFloat32(real(x)) || overflowFloat32(imag(x))
321-
case Complex128:
322-
return false
323-
}
324-
panic("reflect: OverflowComplex of non-complex type " + t.String())
325-
}
326-
327-
func (t *rtype) OverflowFloat(x float64) bool {
328-
k := t.Kind()
329-
switch k {
330-
case Float32:
331-
return overflowFloat32(x)
332-
case Float64:
333-
return false
334-
}
335-
panic("reflect: OverflowFloat of non-float type " + t.String())
336-
}
337-
338-
func (t *rtype) OverflowInt(x int64) bool {
339-
k := t.Kind()
340-
switch k {
341-
case Int, Int8, Int16, Int32, Int64:
342-
bitSize := t.Size() * 8
343-
trunc := (x << (64 - bitSize)) >> (64 - bitSize)
344-
return x != trunc
345-
}
346-
panic("reflect: OverflowInt of non-int type " + t.String())
347-
}
348-
349-
func (t *rtype) OverflowUint(x uint64) bool {
350-
k := t.Kind()
351-
switch k {
352-
case Uint, Uintptr, Uint8, Uint16, Uint32, Uint64:
353-
bitSize := t.Size() * 8
354-
trunc := (x << (64 - bitSize)) >> (64 - bitSize)
355-
return x != trunc
356-
}
357-
panic("reflect: OverflowUint of non-uint type " + t.String())
358-
}
359-
360316
func (t *rtype) common() *abi.Type {
361317
return &t.t
362318
}
@@ -872,6 +828,50 @@ func (t *rtype) IsVariadic() bool {
872828
return tt.IsVariadic()
873829
}
874830

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+
875875
// add returns p+x.
876876
//
877877
// The whySafe string is ignored, so that the function still inlines

0 commit comments

Comments
 (0)