mirror of
https://github.com/golang/go
synced 2024-12-11 15:21:00 +00:00
0a0a7a5642
x - (y - c) == (x - y) + c, not (x - y) - c. Oops. Fixes #70481 Change-Id: I0e54d8e65dd9843c6b92c543ac69d69ee21f617c Reviewed-on: https://go-review.googlesource.com/c/go/+/630397 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Jakub Ciolek <jakub@ciolek.dev> Auto-Submit: Keith Randall <khr@golang.org>
21 lines
373 B
Go
21 lines
373 B
Go
// run
|
|
|
|
// Copyright 2024 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package main
|
|
|
|
const maxUint64 = (1 << 64) - 1
|
|
|
|
//go:noinline
|
|
func f(n uint64) uint64 {
|
|
return maxUint64 - maxUint64%n
|
|
}
|
|
|
|
func main() {
|
|
for i := uint64(1); i < 20; i++ {
|
|
println(i, maxUint64-f(i))
|
|
}
|
|
}
|