blob: 890784634899c35b67fc535c0060eb528202ad27 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
package avro
import (
"unsafe"
)
// 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!
//
// This function is taken from Go std lib:
// https://github.com/golang/go/blob/master/src/runtime/stubs.go#L178
//
//nolint:govet,staticcheck
//go:nosplit
func noescape(p unsafe.Pointer) unsafe.Pointer {
x := uintptr(p)
return unsafe.Pointer(x ^ 0)
}
|