Add skip32_fast method

This commit is contained in:
Nigel Tao committed 2018-07-01 11:14:25 +10:00
1 parent bb4477d91f
commit 2599476d2c
6 files changed
+75 -24

No files matched your search

+9
View File
@@ -224,6 +224,10 @@ func (q *checker) optimizeSuspendible(n *a.Expr, depth uint32) error {
}
func (q *checker) optimizeIOMethodAdvance(receiver *a.Expr, advance *big.Int, update bool) (retOK bool, retErr error) {
// TODO: do two passes? The first one to non-destructively check retOK. The
// second one to drop facts if indeed retOK? Otherwise, an advance
// precondition failure will lose some of the facts in its error message.
retErr = q.facts.update(func(x *a.Expr) (*a.Expr, error) {
// TODO: update (discard?) any facts that merely mention
// receiver.available(), even if they aren't an exact match.
@@ -271,6 +275,11 @@ func (q *checker) optimizeIOMethodAdvance(receiver *a.Expr, advance *big.Int, up
return x, nil
}
if rcv.Cmp(advance) == 0 {
// TODO: delete the (adjusted) fact, as newRCV will be zero, and
// "foo.advance() >= 0" is redundant.
}
// Create a new a.Expr to hold the adjusted RHS constant value, newRCV.
newRCV := big.NewInt(0).Sub(rcv, advance)
id, err := q.tm.Insert(newRCV.String())