1
0
mirror of https://github.com/golang/go synced 2024-10-03 17:21:21 -06:00
go/src/runtime/lfstack_32bit.go
Russ Cox ad8179281d [dev.cc] runtime: convert nacl support to Go
LGTM=dave
R=minux, dave
CC=golang-codereviews
https://golang.org/cl/181030043
2014-11-21 10:22:18 -05:00

22 lines
564 B
Go

// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build 386 arm nacl
package runtime
import "unsafe"
// On 32-bit systems, the stored uint64 has a 32-bit pointer and 32-bit count.
func lfstackPack(node *lfnode, cnt uintptr) uint64 {
return uint64(uintptr(unsafe.Pointer(node)))<<32 | uint64(cnt)
}
func lfstackUnpack(val uint64) (node *lfnode, cnt uintptr) {
node = (*lfnode)(unsafe.Pointer(uintptr(val >> 32)))
cnt = uintptr(val)
return
}