return toType(eface.typ)
}
+// rtypeOf directly extracts the *rtype of the provided value.
+func rtypeOf(i any) *rtype {
+ eface := *(*emptyInterface)(unsafe.Pointer(&i))
+ return eface.typ
+}
+
// ptrMap is the cache for PointerTo.
var ptrMap sync.Map // map[*rtype]*ptrType
v.mustBe(Bool)
}
-var bytesType = TypeOf(([]byte)(nil)).(*rtype)
+var bytesType = rtypeOf(([]byte)(nil))
// Bytes returns v's underlying value.
// It panics if v's underlying value is not a slice of bytes or
panic(&ValueError{"reflect.Value.Float", v.kind()})
}
-var uint8Type = TypeOf(uint8(0)).(*rtype)
+var uint8Type = rtypeOf(uint8(0))
// Index returns v's i'th element.
// It panics if v's Kind is not Array, Slice, or String or i is out of range.
panic(&ValueError{"reflect.Value.Len", v.kind()})
}
-var stringType = TypeOf("").(*rtype)
+var stringType = rtypeOf("")
// MapIndex returns the value associated with key in the map v.
// It panics if v's Kind is not Map.