Files
opencloud/vendor/github.com/gobwas/ws/util_unsafe.go
dependabot[bot] 1fad9acf1a build(deps): bump github.com/onsi/ginkgo/v2 from 2.17.1 to 2.17.2
Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.17.1 to 2.17.2.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.17.1...v2.17.2)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-30 09:59:04 +02:00

23 lines
378 B
Go

//go:build !purego
// +build !purego
package ws
import (
"reflect"
"unsafe"
)
func strToBytes(str string) (bts []byte) {
s := (*reflect.StringHeader)(unsafe.Pointer(&str))
b := (*reflect.SliceHeader)(unsafe.Pointer(&bts))
b.Data = s.Data
b.Len = s.Len
b.Cap = s.Len
return bts
}
func btsToString(bts []byte) (str string) {
return *(*string)(unsafe.Pointer(&bts))
}