Commit a25a7ad7 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

cmd/internal/obj: update Bool2int to the form optimized by the compiler

As of https://golang.org/cl/22711 the compiler optimizes this form.

Updates #6011

Change-Id: Ibc6c529dfa24d42f4aab78ebd6722e1d72cb6038
Reviewed-on: https://go-review.googlesource.com/27395Reviewed-by: 's avatarJosh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 70544c91
......@@ -504,8 +504,13 @@ var Anames = []string{
}
func Bool2int(b bool) int {
// The compiler currently only optimizes this form.
// See issue 6011.
var i int
if b {
return 1
i = 1
} else {
i = 0
}
return 0
return i
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment