]> Cypherpunks repositories - gostls13.git/commitdiff
net: remove unnecessary bit masking
authorMikio Hara <mikioh.mikioh@gmail.com>
Mon, 22 Jul 2013 11:08:58 +0000 (20:08 +0900)
committerMikio Hara <mikioh.mikioh@gmail.com>
Mon, 22 Jul 2013 11:08:58 +0000 (20:08 +0900)
R=dave
CC=golang-dev
https://golang.org/cl/11537044

src/pkg/net/ipraw_test.go

index 12c199d1cf4d5cbbfb580b427a10328e2f0218b0..4f7d85aac74ce8fd86775dd0d308e4e6135ab2bf 100644 (file)
@@ -266,7 +266,7 @@ func (m *icmpMessage) Marshal() ([]byte, error) {
        s = s + s>>16
        // Place checksum back in header; using ^= avoids the
        // assumption the checksum bytes are zero.
-       b[2] ^= byte(^s & 0xff)
+       b[2] ^= byte(^s)
        b[3] ^= byte(^s >> 8)
        return b, nil
 }
@@ -309,8 +309,8 @@ func (p *icmpEcho) Len() int {
 // reply message body p.
 func (p *icmpEcho) Marshal() ([]byte, error) {
        b := make([]byte, 4+len(p.Data))
-       b[0], b[1] = byte(p.ID>>8), byte(p.ID&0xff)
-       b[2], b[3] = byte(p.Seq>>8), byte(p.Seq&0xff)
+       b[0], b[1] = byte(p.ID>>8), byte(p.ID)
+       b[2], b[3] = byte(p.Seq>>8), byte(p.Seq)
        copy(b[4:], p.Data)
        return b, nil
 }