]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: use min & max builtins to assert constant bounds in prove's tests
authorJorropo <jorropo.pgm@gmail.com>
Sun, 9 Mar 2025 13:45:01 +0000 (14:45 +0100)
committerGopher Robot <gobot@golang.org>
Wed, 12 Mar 2025 02:51:59 +0000 (19:51 -0700)
commit554a3c51dc42516867c3df790f48507cc8fdc0af
treeae6a09d52b5281fe6886dded055d6f3977464f57
parentd2842229fce01f8df04bc141291ec4fefb5d4bfc
cmd/compile: use min & max builtins to assert constant bounds in prove's tests

I've originally used |= and &= to setup assumptions exploitable by the
operation under test but theses have multiple issues making it poor
for this usecase:
- &= does not pass the minimum value as-is, rather always set it to 0
- |= rounds up the max value to a number of the same length with all ones set
- I've never implemented them to work with negative signed numbers

Change-Id: Ie43c576fb10393e69d6f989b048823daa02b1df8
Reviewed-on: https://go-review.googlesource.com/c/go/+/656160
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
test/prove.go