aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/modern-go/reflect2/unsafe_iface.go
diff options
context:
space:
mode:
authorLibravatar Rutger Broekhoff2024-01-02 18:56:31 +0100
committerLibravatar Rutger Broekhoff2024-01-02 18:56:31 +0100
commit8db41da676ac8368ef7c2549d56239a5ff5eedde (patch)
tree09c427fd66de2ec1ebffc8342f5fdbb84b0701b5 /vendor/github.com/modern-go/reflect2/unsafe_iface.go
parentd4f75fb6db22e57577867445a022227e70958931 (diff)
downloadgitolfs3-8db41da676ac8368ef7c2549d56239a5ff5eedde.tar.gz
gitolfs3-8db41da676ac8368ef7c2549d56239a5ff5eedde.zip
Delete vendor directory
Diffstat (limited to 'vendor/github.com/modern-go/reflect2/unsafe_iface.go')
-rw-r--r--vendor/github.com/modern-go/reflect2/unsafe_iface.go64
1 files changed, 0 insertions, 64 deletions
diff --git a/vendor/github.com/modern-go/reflect2/unsafe_iface.go b/vendor/github.com/modern-go/reflect2/unsafe_iface.go
deleted file mode 100644
index b601955..0000000
--- a/vendor/github.com/modern-go/reflect2/unsafe_iface.go
+++ /dev/null
@@ -1,64 +0,0 @@
1package reflect2
2
3import (
4 "reflect"
5 "unsafe"
6)
7
8type iface struct {
9 itab *itab
10 data unsafe.Pointer
11}
12
13type itab struct {
14 ignore unsafe.Pointer
15 rtype unsafe.Pointer
16}
17
18func IFaceToEFace(ptr unsafe.Pointer) interface{} {
19 iface := (*iface)(ptr)
20 if iface.itab == nil {
21 return nil
22 }
23 return packEFace(iface.itab.rtype, iface.data)
24}
25
26type UnsafeIFaceType struct {
27 unsafeType
28}
29
30func newUnsafeIFaceType(cfg *frozenConfig, type1 reflect.Type) *UnsafeIFaceType {
31 return &UnsafeIFaceType{
32 unsafeType: *newUnsafeType(cfg, type1),
33 }
34}
35
36func (type2 *UnsafeIFaceType) Indirect(obj interface{}) interface{} {
37 objEFace := unpackEFace(obj)
38 assertType("Type.Indirect argument 1", type2.ptrRType, objEFace.rtype)
39 return type2.UnsafeIndirect(objEFace.data)
40}
41
42func (type2 *UnsafeIFaceType) UnsafeIndirect(ptr unsafe.Pointer) interface{} {
43 return IFaceToEFace(ptr)
44}
45
46func (type2 *UnsafeIFaceType) IsNil(obj interface{}) bool {
47 if obj == nil {
48 return true
49 }
50 objEFace := unpackEFace(obj)
51 assertType("Type.IsNil argument 1", type2.ptrRType, objEFace.rtype)
52 return type2.UnsafeIsNil(objEFace.data)
53}
54
55func (type2 *UnsafeIFaceType) UnsafeIsNil(ptr unsafe.Pointer) bool {
56 if ptr == nil {
57 return true
58 }
59 iface := (*iface)(ptr)
60 if iface.itab == nil {
61 return true
62 }
63 return false
64}