Skip to content

Commit 9bd3753

Browse files
cyphargopherbot
authored andcommitted
unix: switch (*CPUSet).Zero to clear builtin
clear was added to Go 1.21 and is better than the manual loop approach. Change-Id: I851203714446e21b6329e2bcf308f2571d339e36 GitHub-Last-Rev: 71dc7f0 GitHub-Pull-Request: #262 Reviewed-on: https://go-review.googlesource.com/c/sys/+/698495 Reviewed-by: Keith Randall <[email protected]> Reviewed-by: Cherry Mui <[email protected]> Reviewed-by: Keith Randall <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Tobias Klauser <[email protected]> Auto-Submit: Keith Randall <[email protected]>
1 parent 899c232 commit 9bd3753

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

unix/affinity_linux.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ func SchedSetaffinity(pid int, set *CPUSet) error {
3838

3939
// Zero clears the set s, so that it contains no CPUs.
4040
func (s *CPUSet) Zero() {
41-
for i := range s {
42-
s[i] = 0
43-
}
41+
clear(s[:])
4442
}
4543

4644
func cpuBitsIndex(cpu int) int {

0 commit comments

Comments
 (0)