summaryrefslogtreecommitdiff
path: root/vendor/github.com/chenzhuoyu/base64x/faststr.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/chenzhuoyu/base64x/faststr.go')
-rw-r--r--vendor/github.com/chenzhuoyu/base64x/faststr.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/vendor/github.com/chenzhuoyu/base64x/faststr.go b/vendor/github.com/chenzhuoyu/base64x/faststr.go
index 83b58ea1f..7334b063b 100644
--- a/vendor/github.com/chenzhuoyu/base64x/faststr.go
+++ b/vendor/github.com/chenzhuoyu/base64x/faststr.go
@@ -21,3 +21,15 @@ func str2mem(s string) (v []byte) {
func mem2addr(v []byte) unsafe.Pointer {
return *(*unsafe.Pointer)(unsafe.Pointer(&v))
}
+
+// NoEscape hides a pointer from escape analysis. NoEscape is
+// the identity function but escape analysis doesn't think the
+// output depends on the input. NoEscape is inlined and currently
+// compiles down to zero instructions.
+// USE CAREFULLY!
+//go:nosplit
+//goland:noinspection GoVetUnsafePointer
+func noEscape(p unsafe.Pointer) unsafe.Pointer {
+ x := uintptr(p)
+ return unsafe.Pointer(x ^ 0)
+}