]> Cypherpunks repositories - gostls13.git/commitdiff
all: use &^ operator if possible
authorMarvin Stenger <marvin.stenger94@gmail.com>
Tue, 29 Mar 2016 12:09:22 +0000 (14:09 +0200)
committerIan Lance Taylor <iant@golang.org>
Tue, 29 Mar 2016 14:28:41 +0000 (14:28 +0000)
This is a change improving consistency in the source tree.
The pattern foo &= ^bar, was only used six times in src/ directory.
The usage of the supported &^ (bit clear / AND NOT) operator is way more
common, about factor 10x.

Change-Id: If26a2994fd81d23d42189bee00245eb84e672cf3
Reviewed-on: https://go-review.googlesource.com/21224
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/compile/internal/gc/gsubr.go
src/cmd/link/internal/ld/link.go
src/crypto/elliptic/p256.go
src/syscall/exec_unix.go
src/syscall/lsf_linux.go

index 6fa76e765dcc1084176061e094b177ee24e1dbd0..51d1d316e887263961fdbba3aa3f500481b450a3 100644 (file)
@@ -244,7 +244,7 @@ func ggloblLSym(s *obj.LSym, width int32, flags int16) {
        p.From.Sym = s
        if flags&obj.LOCAL != 0 {
                p.From.Sym.Local = true
-               flags &= ^obj.LOCAL
+               flags &^= obj.LOCAL
        }
        p.To.Type = obj.TYPE_CONST
        p.To.Offset = int64(width)
index f1df056adf0ad0d58e5e13461055ce047d7959c2..b00f80abbd5fa0456291c309a4fe9797310eeb2d 100644 (file)
@@ -129,7 +129,7 @@ func (a *Attribute) Set(flag Attribute, value bool) {
        if value {
                *a |= flag
        } else {
-               *a &= ^flag
+               *a &^= flag
        }
 }
 
index e00d4f79f913901d372d973f07607a4990cbe251..05a3311b2903c1fcd0ba796712169586175f1932 100644 (file)
@@ -1056,7 +1056,7 @@ func p256ScalarBaseMult(xOut, yOut, zOut *[p256Limbs]uint32, scalar *[32]uint8)
                        p256CopyConditional(yOut, &ty, mask)
                        p256CopyConditional(zOut, &tz, mask)
                        // If p was not zero, then n is now non-zero.
-                       nIsInfinityMask &= ^pIsNoninfiniteMask
+                       nIsInfinityMask &^= pIsNoninfiniteMask
                }
        }
 }
@@ -1136,7 +1136,7 @@ func p256ScalarMult(xOut, yOut, zOut, x, y *[p256Limbs]uint32, scalar *[32]uint8
                p256CopyConditional(xOut, &tx, mask)
                p256CopyConditional(yOut, &ty, mask)
                p256CopyConditional(zOut, &tz, mask)
-               nIsInfinityMask &= ^pIsNoninfiniteMask
+               nIsInfinityMask &^= pIsNoninfiniteMask
        }
 }
 
index 82e33124e2e721f46f0976c0afdea4296346c5e7..9fd8cf4dba7a76378973687574a3daa379d86a90 100644 (file)
@@ -103,7 +103,7 @@ func SetNonblock(fd int, nonblocking bool) (err error) {
        if nonblocking {
                flag |= O_NONBLOCK
        } else {
-               flag &= ^O_NONBLOCK
+               flag &^= O_NONBLOCK
        }
        _, err = fcntl(fd, F_SETFL, flag)
        return err
index 98e25885ef8f1c1febdd0ab469be873aa2b9353b..4a6aa2d6eb5329a08ea74c450be9f6f87bed4303 100644 (file)
@@ -56,7 +56,7 @@ func SetLsfPromisc(name string, m bool) error {
        if m {
                ifl.flags |= uint16(IFF_PROMISC)
        } else {
-               ifl.flags &= ^uint16(IFF_PROMISC)
+               ifl.flags &^= uint16(IFF_PROMISC)
        }
        _, _, ep = Syscall(SYS_IOCTL, uintptr(s), SIOCSIFFLAGS, uintptr(unsafe.Pointer(&ifl)))
        if ep != 0 {