]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: make isUint{32,64}PowerOfTwo implementations clearer
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Mon, 4 Aug 2025 11:48:43 +0000 (18:48 +0700)
committerGopher Robot <gobot@golang.org>
Tue, 5 Aug 2025 15:32:51 +0000 (08:32 -0700)
commit26da1199ebdddeebc5eebdd562d8a40f01f42a1b
tree7fc3b5f9fbfd450ba6ba37f9c03e6616e72a447b
parent5ab9f23977694ab87614fd30e081d294eb313efd
cmd/compile: make isUint{32,64}PowerOfTwo implementations clearer

Since these functions cast the input to uint64, so the result always
non-negative. The condition should be changed to comparing with zero,
thus maaking it clearer to reader, and open room for simplifying in the
future by using the generic isUnsignedPowerOfTwo function.

Separated this change, so it's easier to do bisecting if there's any
problems happened.

Change-Id: Ibec28c2590f4c52caa36384b710d526459725e49
Reviewed-on: https://go-review.googlesource.com/c/go/+/692915
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
src/cmd/compile/internal/ssa/rewrite.go