diff options
Diffstat (limited to 'src/runtime/lfstack_32bit.go')
-rw-r--r-- | src/runtime/lfstack_32bit.go | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/runtime/lfstack_32bit.go b/src/runtime/lfstack_32bit.go index 0eebbd974..61d8678d9 100644 --- a/src/runtime/lfstack_32bit.go +++ b/src/runtime/lfstack_32bit.go @@ -6,8 +6,16 @@ package runtime +import "unsafe" + // On 32-bit systems, the stored uint64 has a 32-bit pointer and 32-bit count. -const ( - lfPtrBits = 32 - lfCountMask = 1<<32 - 1 -) + +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 +} |