diff --git a/src/runtime/lfstack.go b/src/runtime/lfstack.go index ea640eb12f..1261f54d97 100644 --- a/src/runtime/lfstack.go +++ b/src/runtime/lfstack.go @@ -15,7 +15,7 @@ import ( func lfstackpush(head *uint64, node *lfnode) { node.pushcnt++ new := lfstackPack(node, node.pushcnt) - if node1, _ := lfstackUnpack(new); node1 != node { + if node1 := lfstackUnpack(new); node1 != node { print("runtime: lfstackpush invalid packing: node=", node, " cnt=", hex(node.pushcnt), " packed=", hex(new), " -> node=", node1, "\n") throw("lfstackpush") } @@ -34,7 +34,7 @@ func lfstackpop(head *uint64) unsafe.Pointer { if old == 0 { return nil } - node, _ := lfstackUnpack(old) + node := lfstackUnpack(old) next := atomic.Load64(&node.next) if atomic.Cas64(head, old, next) { return unsafe.Pointer(node) diff --git a/src/runtime/lfstack_32bit.go b/src/runtime/lfstack_32bit.go index 36811c1e47..2f59e0212e 100644 --- a/src/runtime/lfstack_32bit.go +++ b/src/runtime/lfstack_32bit.go @@ -14,8 +14,6 @@ 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 +func lfstackUnpack(val uint64) *lfnode { + return (*lfnode)(unsafe.Pointer(uintptr(val >> 32))) } diff --git a/src/runtime/lfstack_64bit.go b/src/runtime/lfstack_64bit.go index 27a058c763..07c2a141f0 100644 --- a/src/runtime/lfstack_64bit.go +++ b/src/runtime/lfstack_64bit.go @@ -28,8 +28,6 @@ func lfstackPack(node *lfnode, cnt uintptr) uint64 { return uint64(uintptr(unsafe.Pointer(node)))<<(64-addrBits) | uint64(cnt&(1<> cntBits << 3))) - cnt = uintptr(val & (1<> cntBits << 3))) } diff --git a/src/runtime/lfstack_amd64.go b/src/runtime/lfstack_amd64.go index 0a71455c6b..6397e1d47f 100644 --- a/src/runtime/lfstack_amd64.go +++ b/src/runtime/lfstack_amd64.go @@ -17,8 +17,6 @@ func lfstackPack(node *lfnode, cnt uintptr) uint64 { return uint64(uintptr(unsafe.Pointer(node)))<<16 | uint64(cnt&(1<<19-1)) } -func lfstackUnpack(val uint64) (node *lfnode, cnt uintptr) { - node = (*lfnode)(unsafe.Pointer(uintptr(int64(val) >> 19 << 3))) - cnt = uintptr(val & (1<<19 - 1)) - return +func lfstackUnpack(val uint64) *lfnode { + return (*lfnode)(unsafe.Pointer(uintptr(int64(val) >> 19 << 3))) }