Skip to content

Commit

Permalink
all: remove redundant type conversion
Browse files Browse the repository at this point in the history
Change-Id: I375233dc700adbc58a6d4af995d07b352bf85b11
GitHub-Last-Rev: ef12920
GitHub-Pull-Request: golang#55994
Reviewed-on: https://go-review.googlesource.com/c/go/+/437715
Run-TryBot: Ian Lance Taylor <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
Auto-Submit: Ian Lance Taylor <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Reviewed-by: Keith Randall <[email protected]>
  • Loading branch information
cuishuang authored and gopherbot committed Oct 6, 2022
1 parent 755a292 commit b314eea
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/cmd/internal/obj/wasm/wasmobj.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ func preprocess(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) {
p = appendp(p, AGet, regAddr(REGG))
p = appendp(p, AI32WrapI64)
p = appendp(p, AI32Load, constAddr(2*int64(ctxt.Arch.PtrSize))) // G.stackguard0
p = appendp(p, AI32Const, constAddr(int64(framesize)-objabi.StackSmall))
p = appendp(p, AI32Const, constAddr(framesize-objabi.StackSmall))
p = appendp(p, AI32Add)
p = appendp(p, AI32LeU)
}
Expand Down Expand Up @@ -577,18 +577,18 @@ func preprocess(ctxt *obj.Link, s *obj.LSym, newprog obj.ProgAlloc) {
for p := s.Func().Text; p != nil; p = p.Link {
switch p.From.Name {
case obj.NAME_AUTO:
p.From.Offset += int64(framesize)
p.From.Offset += framesize
case obj.NAME_PARAM:
p.From.Reg = REG_SP
p.From.Offset += int64(framesize) + 8 // parameters are after the frame and the 8-byte return address
p.From.Offset += framesize + 8 // parameters are after the frame and the 8-byte return address
}

switch p.To.Name {
case obj.NAME_AUTO:
p.To.Offset += int64(framesize)
p.To.Offset += framesize
case obj.NAME_PARAM:
p.To.Reg = REG_SP
p.To.Offset += int64(framesize) + 8 // parameters are after the frame and the 8-byte return address
p.To.Offset += framesize + 8 // parameters are after the frame and the 8-byte return address
}

switch p.As {
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/sha1/sha1.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (d *digest) MarshalBinary() ([]byte, error) {
b = binary.BigEndian.AppendUint32(b, d.h[3])
b = binary.BigEndian.AppendUint32(b, d.h[4])
b = append(b, d.x[:d.nx]...)
b = b[:len(b)+len(d.x)-int(d.nx)] // already zero
b = b[:len(b)+len(d.x)-d.nx] // already zero
b = binary.BigEndian.AppendUint64(b, d.len)
return b, nil
}
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/sha256/sha256.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (d *digest) MarshalBinary() ([]byte, error) {
b = binary.BigEndian.AppendUint32(b, d.h[6])
b = binary.BigEndian.AppendUint32(b, d.h[7])
b = append(b, d.x[:d.nx]...)
b = b[:len(b)+len(d.x)-int(d.nx)] // already zero
b = b[:len(b)+len(d.x)-d.nx] // already zero
b = binary.BigEndian.AppendUint64(b, d.len)
return b, nil
}
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/sha512/sha512.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (d *digest) MarshalBinary() ([]byte, error) {
b = binary.BigEndian.AppendUint64(b, d.h[6])
b = binary.BigEndian.AppendUint64(b, d.h[7])
b = append(b, d.x[:d.nx]...)
b = b[:len(b)+len(d.x)-int(d.nx)] // already zero
b = b[:len(b)+len(d.x)-d.nx] // already zero
b = binary.BigEndian.AppendUint64(b, d.len)
return b, nil
}
Expand Down
2 changes: 1 addition & 1 deletion src/encoding/asn1/asn1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func TestParseInt32(t *testing.T) {
if (err == nil) != test.ok {
t.Errorf("#%d: Incorrect error result (did fail? %v, expected: %v)", i, err == nil, test.ok)
}
if test.ok && int32(ret) != test.out {
if test.ok && ret != test.out {
t.Errorf("#%d: Bad result: %v (expected %v)", i, ret, test.out)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/encoding/base32/base32_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func TestReaderEOF(t *testing.T) {
decoder := NewDecoder(StdEncoding, &br)
dbuf := make([]byte, StdEncoding.DecodedLen(len(input)))
n, err := decoder.Read(dbuf)
testEqual(t, "Decoding of %q err = %v, expected %v", string(input), err, error(nil))
testEqual(t, "Decoding of %q err = %v, expected %v", input, err, error(nil))
n, err = decoder.Read(dbuf)
testEqual(t, "Read after EOF, n = %d, expected %d", n, 0)
testEqual(t, "Read after EOF, err = %v, expected %v", err, io.EOF)
Expand Down

0 comments on commit b314eea

Please sign in to comment.