No functional changes. Passes toolstash -cmp.
Change-Id: I4fba0c248645c3910ee3f7fc99dacafb676c5dc2
Reviewed-on: https://go-review.googlesource.com/8911
Reviewed-by: Ian Lance Taylor <iant@golang.org>
case gc.CTINT, gc.CTRUNE:
return gc.Mpgetfix(n.Val.U.Xval), true
case gc.CTBOOL:
- return int64(n.Val.U.Bval), true
+ return int64(bool2int(n.Val.U.Bval)), true
}
return
}
case gc.CTINT, gc.CTRUNE:
return gc.Mpgetfix(n.Val.U.Xval), true
case gc.CTBOOL:
- return int64(n.Val.U.Bval), true
+ return int64(bool2int(n.Val.U.Bval)), true
}
return
}
// need to ask if it is bool?
case OLITERAL:
- if !true_ == (n.Val.U.Bval == 0) {
+ if true_ == n.Val.U.Bval {
Patch(Gbranch(obj.AJMP, nil, likely), to)
}
return
mpnegflt(&v.U.Cval.Imag)
case ONOT<<16 | CTBOOL:
- if v.U.Bval == 0 {
+ if !v.U.Bval {
goto settrue
}
goto setfalse
goto setfalse
case OOROR<<16 | CTBOOL:
- if v.U.Bval != 0 || rv.U.Bval != 0 {
+ if v.U.Bval || rv.U.Bval {
goto settrue
}
goto setfalse
case OANDAND<<16 | CTBOOL:
- if v.U.Bval != 0 && rv.U.Bval != 0 {
+ if v.U.Bval && rv.U.Bval {
goto settrue
}
goto setfalse
i = Mpgetfix(val.U.Xval)
case CTBOOL:
- i = int64(val.U.Bval)
+ i = int64(bool2int(val.U.Bval))
case CTNIL:
i = 0
return strconv.Quote(v.U.Sval)
case CTBOOL:
- if v.U.Bval != 0 {
+ if v.U.Bval {
return "true"
}
return "false"
Ctype int16
U struct {
Reg int16 // OREGISTER
- Bval int16 // bool value CTBOOL
+ Bval bool // bool value CTBOOL
Xval *Mpint // int CTINT, rune CTRUNE
Fval *Mpflt // float CTFLT
Cval *Mpcplx // float CTCPLX
case CTBOOL:
a.Sym = nil
a.Type = obj.TYPE_CONST
- a.Offset = int64(n.Val.U.Bval)
+ a.Offset = int64(bool2int(n.Val.U.Bval))
case CTNIL:
a.Sym = nil
return n.Val.U.Sval == ""
case CTBOOL:
- return n.Val.U.Bval == 0
+ return !n.Val.U.Bval
case CTINT, CTRUNE:
return mpcmpfixc(n.Val.U.Xval, 0) == 0
func Nodbool(b bool) *Node {
c := Nodintconst(0)
c.Val.Ctype = CTBOOL
- c.Val.U.Bval = int16(bool2int(b))
+ c.Val.U.Bval = b
c.Type = idealbool
return c
}
s.kind = switchKindExpr
if Isconst(sw.Ntest, CTBOOL) {
s.kind = switchKindTrue
- if sw.Ntest.Val.U.Bval == 0 {
+ if !sw.Ntest.Val.U.Bval {
s.kind = switchKindFalse
}
}
if Eqtype(a.Left.Type, n.Type) {
cmp.Right = a.Left
evconst(&cmp)
- b = uint32(cmp.Val.U.Bval)
+ b = uint32(bool2int(cmp.Val.U.Bval))
}
} else if Eqtype(a.Type, n.Type) {
cmp.Right = a
evconst(&cmp)
- b = uint32(cmp.Val.U.Bval)
+ b = uint32(bool2int(cmp.Val.U.Bval))
}
if b != 0 {