gvisor/pkg/tcpip/link/sharedmem/sharedmem_unsafe.go

16 lines
431 B
Go

// Copyright 2016 The Netstack Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package sharedmem
import (
"unsafe"
)
// sharedDataPointer converts the shared data slice into a pointer so that it
// can be used in atomic operations.
func sharedDataPointer(sharedData []byte) *uint32 {
return (*uint32)(unsafe.Pointer(&sharedData[0:4][0]))
}