]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/abi: use clear built-in
authorKir Kolyshkin <kolyshkin@gmail.com>
Thu, 18 Sep 2025 01:00:10 +0000 (18:00 -0700)
committerSean Liao <sean@liao.dev>
Thu, 18 Sep 2025 22:31:10 +0000 (15:31 -0700)
Replace for loop with clear, available since Go 1.21.

Change-Id: I949da08b2a11845cc8a02b2639af78835e316970
Reviewed-on: https://go-review.googlesource.com/c/go/+/704879
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
src/cmd/compile/internal/abi/abiutils.go

index c013aba19c41a61ef9d14432139f50fe91a0b0e0..dacaad3f30083364636ff6008966e00c4ca05e29 100644 (file)
@@ -661,9 +661,7 @@ func (state *assignState) tryAllocRegs(typ *types.Type) []RegIndex {
 func (pa *ABIParamAssignment) ComputePadding(storage []uint64) []uint64 {
        nr := len(pa.Registers)
        padding := storage[:nr]
-       for i := 0; i < nr; i++ {
-               padding[i] = 0
-       }
+       clear(padding)
        if pa.Type.Kind() != types.TSTRUCT || nr == 0 {
                return padding
        }