Skip to content

Set little_endian in the same way that boolbv_byte_extract already does #2429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/solvers/flattening/boolbv_byte_extract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ bvt boolbvt::convert_byte_extract(const byte_extract_exprt &expr)

const exprt &op=expr.op();
const exprt &offset=expr.offset();
PRECONDITION(
expr.id() == ID_byte_extract_little_endian ||
expr.id() == ID_byte_extract_big_endian);
const bool little_endian = expr.id() == ID_byte_extract_little_endian;

// first do op0
Expand Down
12 changes: 4 additions & 8 deletions src/solvers/flattening/boolbv_byte_update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,10 @@ bvt boolbvt::convert_byte_update(const byte_update_exprt &expr)
const exprt &offset_expr=expr.offset();
const exprt &value=expr.value();

bool little_endian;

if(expr.id()==ID_byte_update_little_endian)
little_endian=true;
else if(expr.id()==ID_byte_update_big_endian)
little_endian=false;
else
UNREACHABLE;
PRECONDITION(
expr.id() == ID_byte_update_little_endian ||
expr.id() == ID_byte_update_big_endian);
const bool little_endian = expr.id() == ID_byte_update_little_endian;

bvt bv=convert_bv(op);

Expand Down
12 changes: 4 additions & 8 deletions src/solvers/flattening/flatten_byte_operators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,10 @@ exprt flatten_byte_extract(

assert(src.operands().size()==2);

bool little_endian;

if(src.id()==ID_byte_extract_little_endian)
little_endian=true;
else if(src.id()==ID_byte_extract_big_endian)
little_endian=false;
else
UNREACHABLE;
PRECONDITION(
src.id() == ID_byte_extract_little_endian ||
src.id() == ID_byte_extract_big_endian);
const bool little_endian = src.id() == ID_byte_extract_little_endian;

// determine an upper bound of the number of bytes we might need
exprt upper_bound=size_of_expr(src.type(), ns);
Expand Down