From e6a20866b655424c5024d00d1ff34d691a4dd0d9 Mon Sep 17 00:00:00 2001 From: fumiama Date: Fri, 26 Nov 2021 18:48:05 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20=20=E4=BC=98=E5=8C=96=20ge?= =?UTF-8?q?tea?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_b14/main.go | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/plugin_b14/main.go b/plugin_b14/main.go index 6ba17a36..0c6a1003 100644 --- a/plugin_b14/main.go +++ b/plugin_b14/main.go @@ -62,18 +62,6 @@ func init() { }) } -// Slice is the runtime representation of a slice. -// It cannot be used safely or portably and its representation may -// change in a later release. -// -// Unlike reflect.SliceHeader, its Data field is sufficient to guarantee the -// data it references will not be garbage collected. -type slice struct { - Data unsafe.Pointer - Len int - Cap int -} - func getea(key string) tea.TEA { kr := []rune(key) if len(kr) > 4 { @@ -83,8 +71,5 @@ func getea(key string) tea.TEA { kr = append(kr, rune(4-len(kr))) } } - skr := *(*slice)(unsafe.Pointer(&kr)) - skr.Len *= 4 - skr.Cap *= 4 - return tea.NewTeaCipher(*(*[]byte)(unsafe.Pointer(&skr))) + return *(*tea.TEA)(*(*unsafe.Pointer)(unsafe.Pointer(&kr))) }