summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/link/sharedmem/sharedmem_unsafe.go
blob: 52f93f480bb45363ba8e5b66f6502dee11ccb7e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// 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]))
}