mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-12 02:00:24 +00:00
✏️ str byte 转换改用 zb 的工具
This commit is contained in:
15
data/mem.go
15
data/mem.go
@@ -1,15 +0,0 @@
|
||||
package data
|
||||
|
||||
import "unsafe"
|
||||
|
||||
// Str2bytes Fast convert
|
||||
func Str2bytes(s string) []byte {
|
||||
x := (*[2]uintptr)(unsafe.Pointer(&s))
|
||||
h := [3]uintptr{x[0], x[1], x[1]}
|
||||
return *(*[]byte)(unsafe.Pointer(&h))
|
||||
}
|
||||
|
||||
// Bytes2str Fast convert
|
||||
func Bytes2str(b []byte) string {
|
||||
return *(*string)(unsafe.Pointer(&b))
|
||||
}
|
||||
Reference in New Issue
Block a user