3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-12-21 03:33:43 +00:00

hide bit-vector dependencies under seq_util

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2018-12-03 08:45:17 -08:00
parent dbfeeb8b1c
commit 2aa7ccc4a9
16 changed files with 89 additions and 97 deletions

View file

@ -20,6 +20,7 @@ Revision History:
#include "ast/arith_decl_plugin.h"
#include "ast/array_decl_plugin.h"
#include "ast/ast_pp.h"
#include "ast/bv_decl_plugin.h"
#include <sstream>
static bool is_hex_digit(char ch, unsigned& d) {
@ -967,6 +968,24 @@ app* seq_util::str::mk_char(char ch) const {
return mk_char(s, 0);
}
bool seq_util::is_const_char(expr* e, unsigned& c) const {
bv_util bv(m);
rational r;
unsigned sz;
return bv.is_numeral(e, r, sz) && r.is_unsigned(), c = r.get_unsigned(), true;
}
app* seq_util::mk_char(unsigned ch) const {
bv_util bv(m);
return bv.mk_numeral(rational(ch), 8);
}
app* seq_util::mk_le(expr* ch1, expr* ch2) const {
bv_util bv(m);
return bv.mk_ule(ch1, ch2);
}
bool seq_util::str::is_string(expr const* n, zstring& s) const {
if (is_string(n)) {
s = zstring(to_app(n)->get_decl()->get_parameter(0).get_symbol().bare_str());