]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/ssa: simplify with built-in min, max functions
authorMarcel Meyer <mm.marcelmeyer@gmail.com>
Thu, 10 Apr 2025 21:52:25 +0000 (21:52 +0000)
committerKeith Randall <khr@golang.org>
Fri, 11 Apr 2025 15:50:53 +0000 (08:50 -0700)
Change-Id: I08fa2940cd3565c578b1b323656a4fa12e0c65bb
GitHub-Last-Rev: 1f673b190ee62fe8158c9e70acf6b0882f6b3f6e
GitHub-Pull-Request: golang/go#73322
Reviewed-on: https://go-review.googlesource.com/c/go/+/664675
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/ssa/writebarrier.go

index e235659dc0a4522a9cee68ec4e71f71b868c6d2a..9ef3667d516d460c19714979d47b36a3790dcb1e 100644 (file)
@@ -637,17 +637,12 @@ func (f *Func) computeZeroMap(select1 []*Value) map[ID]ZeroRegion {
                                        size += ptrSize - d
                                }
                                // Clip to the 64 words that we track.
-                               min := off
-                               max := off + size
-                               if min < 0 {
-                                       min = 0
-                               }
-                               if max > 64*ptrSize {
-                                       max = 64 * ptrSize
-                               }
+                               minimum := max(off, 0)
+                               maximum := min(off+size, 64*ptrSize)
+
                                // Clear bits for parts that we are writing (and hence
                                // will no longer necessarily be zero).
-                               for i := min; i < max; i += ptrSize {
+                               for i := minimum; i < maximum; i += ptrSize {
                                        bit := i / ptrSize
                                        z.mask &^= 1 << uint(bit)
                                }