]> Cypherpunks repositories - gostls13.git/commitdiff
all: remove redundant type conversion
authorcui fliter <imcusg@gmail.com>
Wed, 5 Oct 2022 03:15:24 +0000 (03:15 +0000)
committerGopher Robot <gobot@golang.org>
Thu, 6 Oct 2022 04:37:00 +0000 (04:37 +0000)
Change-Id: I375233dc700adbc58a6d4af995d07b352bf85b11
GitHub-Last-Rev: ef129205231b892f61b0135c87bb791a5e1a126c
GitHub-Pull-Request: golang/go#55994
Reviewed-on: https://go-review.googlesource.com/c/go/+/437715
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
src/cmd/internal/obj/wasm/wasmobj.go
src/crypto/sha1/sha1.go
src/crypto/sha256/sha256.go
src/crypto/sha512/sha512.go
src/encoding/asn1/asn1_test.go
src/encoding/base32/base32_test.go

index 1c726f77d34869c9fad72b77ca357aaf2237ed3d..59b2e7bddc7bdadbfe0979b02bb9a44965639181 100644 (file)
@@ -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)
                }
@@ -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 {
index 80c5623725bf05250c00885a6af35afed5794e3d..bef447c7f2dc5d311cb6fd71d667fd9b97c00416 100644 (file)
@@ -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
 }
index 92abbf9b84362e0140fb655ffba0f5a748fc99e0..15c907ecf7f8166071ef8ad00769b4bce86d6f09 100644 (file)
@@ -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
 }
index 883948f482bfb5ba26f9506ae8fa9699e09271d3..3819478ed75742750da9a49ca08f2e19bfe3748b 100644 (file)
@@ -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
 }
index b1e05b96ae39550f9417ec0c25a8a2f558547d54..90bdfcddf994ede1232f62d67428f29748f40d84 100644 (file)
@@ -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)
                }
        }
index 5996b08cd8f02a0a802f251a4228c4cd6bda2478..8118531b383e6559b963efccb50d954a0f6cf677 100644 (file)
@@ -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)