From: Austin Clements Date: Thu, 21 Jan 2016 18:44:16 +0000 (-0500) Subject: runtime: eliminate a conditional branch from heapBits.bits X-Git-Tag: go1.7beta1~1709 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=4eb33f6b8d6d1de70d7c08ab1258dd2852ecebe4;p=gostls13.git runtime: eliminate a conditional branch from heapBits.bits Change-Id: I1fa5e629b2890a8509559ce4ea17b74f47d71925 Reviewed-on: https://go-review.googlesource.com/19637 Reviewed-by: Ian Lance Taylor Run-TryBot: Austin Clements TryBot-Result: Gobot Gobot --- diff --git a/src/runtime/mbitmap.go b/src/runtime/mbitmap.go index 04992890a1..154fc3e0f3 100644 --- a/src/runtime/mbitmap.go +++ b/src/runtime/mbitmap.go @@ -290,7 +290,9 @@ func (h heapBits) forward(n uintptr) heapBits { // The result includes in its higher bits the bits for subsequent words // described by the same bitmap byte. func (h heapBits) bits() uint32 { - return uint32(*h.bitp) >> h.shift + // The (shift & 31) eliminates a test and conditional branch + // from the generated code. + return uint32(*h.bitp) >> (h.shift & 31) } // isMarked reports whether the heap bits have the marked bit set.