mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-06-18 13:35:03 +08:00
parent
91f9576e48
commit
d9cc29c678
@ -50,7 +50,11 @@ func ConvertSubVersionToInt(str string) int32 {
|
|||||||
|
|
||||||
// B2S converts byte slice to a string without memory allocation.
|
// B2S converts byte slice to a string without memory allocation.
|
||||||
func B2S(b []byte) string {
|
func B2S(b []byte) string {
|
||||||
return unsafe.String(&b[0], len(b))
|
size := len(b)
|
||||||
|
if size == 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return unsafe.String(&b[0], size)
|
||||||
}
|
}
|
||||||
|
|
||||||
// S2B converts string to a byte slice without memory allocation.
|
// S2B converts string to a byte slice without memory allocation.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user