mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-24 08:52:18 +01:00
Rename some vars for consistency.
This commit is contained in:
1 parent
d276ed52f4
commit
747247a557
1 file changed
+15
-15
+15
-15
@@ -14,14 +14,14 @@ import (
|
|||||||
|
|
||||||
type facts []*a.Expr
|
type facts []*a.Expr
|
||||||
|
|
||||||
func (z *facts) appendFact(x *a.Expr) {
|
func (z *facts) appendFact(fact *a.Expr) {
|
||||||
// TODO: make this faster than O(N) by keeping facts sorted somehow?
|
// TODO: make this faster than O(N) by keeping facts sorted somehow?
|
||||||
for _, f := range *z {
|
for _, x := range *z {
|
||||||
if f.Eq(x) {
|
if x.Eq(fact) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*z = append(*z, x)
|
*z = append(*z, fact)
|
||||||
}
|
}
|
||||||
|
|
||||||
// update applies f to each fact, replacing the slice element with the result
|
// update applies f to each fact, replacing the slice element with the result
|
||||||
@@ -47,13 +47,13 @@ func (z facts) refine(n *a.Expr, nMin *big.Int, nMax *big.Int) (*big.Int, *big.I
|
|||||||
return nMin, nMax
|
return nMin, nMax
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, f := range z {
|
for _, x := range z {
|
||||||
fMin, fMax := refine(f, n.ID1())
|
xMin, xMax := refine(x, n.ID1())
|
||||||
if fMin != nil && nMin.Cmp(fMin) < 0 {
|
if xMin != nil && nMin.Cmp(xMin) < 0 {
|
||||||
nMin = fMin
|
nMin = xMin
|
||||||
}
|
}
|
||||||
if fMax != nil && nMax.Cmp(fMax) > 0 {
|
if xMax != nil && nMax.Cmp(xMax) > 0 {
|
||||||
nMax = fMax
|
nMax = xMax
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nMin, nMax
|
return nMin, nMax
|
||||||
@@ -177,17 +177,17 @@ func (q *checker) proveBinaryOp(op t.Key, lhs *a.Expr, rhs *a.Expr) (ok bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, f := range q.facts {
|
for _, x := range q.facts {
|
||||||
if !f.LHS().Expr().Eq(lhs) {
|
if !x.LHS().Expr().Eq(lhs) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
factOp := f.ID0().Key()
|
factOp := x.ID0().Key()
|
||||||
if factOp == op && f.RHS().Expr().Eq(rhs) {
|
if factOp == op && x.RHS().Expr().Eq(rhs) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if factOp == t.KeyXBinaryEqEq && rhsCV != nil {
|
if factOp == t.KeyXBinaryEqEq && rhsCV != nil {
|
||||||
if factCV := f.RHS().Expr().ConstValue(); factCV != nil {
|
if factCV := x.RHS().Expr().ConstValue(); factCV != nil {
|
||||||
switch op {
|
switch op {
|
||||||
case t.KeyXBinaryNotEq:
|
case t.KeyXBinaryNotEq:
|
||||||
return factCV.Cmp(rhsCV) != 0
|
return factCV.Cmp(rhsCV) != 0
|
||||||
|
|||||||
Reference in new issue
Block a user