mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
all: eliminate unnecessary type conversions
Found by github.com/mdempsky/unconvert
Change-Id: I88ce10390a49ba768a4deaa0df9057c93c1164de
GitHub-Last-Rev: 3b0f7e8f74
GitHub-Pull-Request: golang/go#75974
Reviewed-on: https://go-review.googlesource.com/c/go/+/712940
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
parent
694182d77b
commit
a5a249d6a6
61 changed files with 202 additions and 203 deletions
|
|
@ -33,7 +33,7 @@ func testMagicExhaustive(t *testing.T, n uint) {
|
|||
min := -int64(1) << (n - 1)
|
||||
max := int64(1) << (n - 1)
|
||||
for c := int64(1); c < max; c++ {
|
||||
if !smagicOK(n, int64(c)) {
|
||||
if !smagicOK(n, c) {
|
||||
continue
|
||||
}
|
||||
m := int64(smagic(n, c).m)
|
||||
|
|
@ -164,11 +164,11 @@ func TestMagicSigned(t *testing.T) {
|
|||
if c>>(n-1) != 0 {
|
||||
continue // not appropriate for the given n.
|
||||
}
|
||||
if !smagicOK(n, int64(c)) {
|
||||
if !smagicOK(n, c) {
|
||||
t.Errorf("expected n=%d c=%d to pass\n", n, c)
|
||||
}
|
||||
m := smagic(n, int64(c)).m
|
||||
s := smagic(n, int64(c)).s
|
||||
m := smagic(n, c).m
|
||||
s := smagic(n, c).s
|
||||
|
||||
C := new(big.Int).SetInt64(c)
|
||||
M := new(big.Int).SetUint64(m)
|
||||
|
|
@ -308,13 +308,13 @@ func testDivisibleExhaustive(t *testing.T, n uint) {
|
|||
minI := -int64(1) << (n - 1)
|
||||
maxI := int64(1) << (n - 1)
|
||||
for c := int64(1); c < maxI; c++ {
|
||||
if !sdivisibleOK(n, int64(c)) {
|
||||
if !sdivisibleOK(n, c) {
|
||||
continue
|
||||
}
|
||||
k := sdivisible(n, int64(c)).k
|
||||
m := sdivisible(n, int64(c)).m
|
||||
a := sdivisible(n, int64(c)).a
|
||||
max := sdivisible(n, int64(c)).max
|
||||
k := sdivisible(n, c).k
|
||||
m := sdivisible(n, c).m
|
||||
a := sdivisible(n, c).a
|
||||
max := sdivisible(n, c).max
|
||||
mask := ^uint64(0) >> (64 - n)
|
||||
for i := minI; i < maxI; i++ {
|
||||
want := i%c == 0
|
||||
|
|
@ -369,13 +369,13 @@ func TestDivisibleSigned(t *testing.T) {
|
|||
if c>>(n-1) != 0 {
|
||||
continue // not appropriate for the given n.
|
||||
}
|
||||
if !sdivisibleOK(n, int64(c)) {
|
||||
if !sdivisibleOK(n, c) {
|
||||
t.Errorf("expected n=%d c=%d to pass\n", n, c)
|
||||
}
|
||||
k := sdivisible(n, int64(c)).k
|
||||
m := sdivisible(n, int64(c)).m
|
||||
a := sdivisible(n, int64(c)).a
|
||||
max := sdivisible(n, int64(c)).max
|
||||
k := sdivisible(n, c).k
|
||||
m := sdivisible(n, c).m
|
||||
a := sdivisible(n, c).a
|
||||
max := sdivisible(n, c).max
|
||||
mask := ^uint64(0) >> (64 - n)
|
||||
|
||||
C := new(big.Int).SetInt64(c)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue