summaryrefslogtreecommitdiff
path: root/vendor/github.com/bytedance/sonic/internal/rt/fastvalue.go
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2024-03-11 10:12:06 +0000
committerLibravatar GitHub <noreply@github.com>2024-03-11 10:12:06 +0000
commite24efcac8b67baa9454bf27631e5e49f898a88d4 (patch)
treed9adec2f05e1d8714edee66062a4b95a81ee2a61 /vendor/github.com/bytedance/sonic/internal/rt/fastvalue.go
parent[bugfix] Fix whitespace move_id issue (#2742) (diff)
downloadgotosocial-e24efcac8b67baa9454bf27631e5e49f898a88d4.tar.xz
[chore]: Bump github.com/gin-contrib/cors from 1.5.0 to 1.7.0 (#2745)
Diffstat (limited to 'vendor/github.com/bytedance/sonic/internal/rt/fastvalue.go')
-rw-r--r--vendor/github.com/bytedance/sonic/internal/rt/fastvalue.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/vendor/github.com/bytedance/sonic/internal/rt/fastvalue.go b/vendor/github.com/bytedance/sonic/internal/rt/fastvalue.go
index 2b2757f5b..befaeb715 100644
--- a/vendor/github.com/bytedance/sonic/internal/rt/fastvalue.go
+++ b/vendor/github.com/bytedance/sonic/internal/rt/fastvalue.go
@@ -211,3 +211,24 @@ func findReflectRtypeItab() *GoItab {
v := reflect.TypeOf(struct{}{})
return (*GoIface)(unsafe.Pointer(&v)).Itab
}
+
+func AssertI2I2(t *GoType, i GoIface) (r GoIface) {
+ inter := IfaceType(t)
+ tab := i.Itab
+ if tab == nil {
+ return
+ }
+ if (*GoInterfaceType)(tab.it) != inter {
+ tab = Getitab(inter, tab.Vt, true)
+ if tab == nil {
+ return
+ }
+ }
+ r.Itab = tab
+ r.Value = i.Value
+ return
+}
+
+//go:noescape
+//go:linkname Getitab runtime.getitab
+func Getitab(inter *GoInterfaceType, typ *GoType, canfail bool) *GoItab