Commit d0fb6497 authored by Marvin Stenger's avatar Marvin Stenger Committed by Ian Lance Taylor

all: use &^ operator if possible

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/21224Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent d733cef7
......@@ -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)
......
......@@ -129,7 +129,7 @@ func (a *Attribute) Set(flag Attribute, value bool) {
if value {
*a |= flag
} else {
*a &= ^flag
*a &^= flag
}
}
......
......@@ -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
}
}
......
......@@ -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
......
......@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment