diff options
| author | Austin Clements <austin@google.com> | 2016-01-21 13:44:16 -0500 |
|---|---|---|
| committer | Austin Clements <austin@google.com> | 2016-02-25 23:37:29 +0000 |
| commit | 4eb33f6b8d6d1de70d7c08ab1258dd2852ecebe4 (patch) | |
| tree | 459b9f2e6079bfbfd9731e7ed91247c61267588b /src | |
| parent | 0168c2676f73071331cd385cb3d174313c857738 (diff) | |
| download | go-4eb33f6b8d6d1de70d7c08ab1258dd2852ecebe4.tar.xz | |
runtime: eliminate a conditional branch from heapBits.bits
Change-Id: I1fa5e629b2890a8509559ce4ea17b74f47d71925
Reviewed-on: https://go-review.googlesource.com/19637
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src')
| -rw-r--r-- | src/runtime/mbitmap.go | 4 |
1 files changed, 3 insertions, 1 deletions
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. |
