diff options
author | Andres Noetzli <andres.noetzli@gmail.com> | 2020-12-01 23:44:21 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-01 23:44:21 -0800 |
commit | 6b92c671980054cd30f72715d6081bff59c1e03a (patch) | |
tree | 901954e7cef1b4ee86026af25bd7efb63abd5494 /src/theory/strings/strings_rewriter.cpp | |
parent | 4b311b17906994186a6c58ee1cb3aaeb590231f5 (diff) | |
parent | 901cea314c4dc3be411c345e42c858063fe5aa1b (diff) |
Merge branch 'master' into fixClangWarningsfixClangWarnings
Diffstat (limited to 'src/theory/strings/strings_rewriter.cpp')
-rw-r--r-- | src/theory/strings/strings_rewriter.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/theory/strings/strings_rewriter.cpp b/src/theory/strings/strings_rewriter.cpp index 932b5c8cc..575c33501 100644 --- a/src/theory/strings/strings_rewriter.cpp +++ b/src/theory/strings/strings_rewriter.cpp @@ -251,15 +251,13 @@ Node StringsRewriter::rewriteStringLeq(Node n) { String s = n1[0].getConst<String>(); String t = n2[0].getConst<String>(); - // only need to truncate if s is longer - if (s.size() > t.size()) + size_t prefixLen = std::min(s.size(), t.size()); + s = s.prefix(prefixLen); + t = t.prefix(prefixLen); + // if the prefixes are not the same, then we can already decide the outcome + if (s != t) { - s = s.prefix(t.size()); - } - // if prefix is not leq, then entire string is not leq - if (!s.isLeq(t)) - { - Node ret = nm->mkConst(false); + Node ret = nm->mkConst(s.isLeq(t)); return returnRewrite(n, ret, Rewrite::STR_LEQ_CPREFIX); } } |