Skip to content

remove bitwise_neg(mp_integer) #3104

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
Oct 6, 2018
Merged

remove bitwise_neg(mp_integer) #3104

merged 1 commit into from
Oct 6, 2018

Conversation

kroening
Copy link
Member

@kroening kroening commented Oct 6, 2018

The semantics of this operation is highly machine-dependent, and thus, it's
difficult to use. The single user is replaced by xor -1.

  • Each commit message has a non-empty body, explaining why the change was made.
  • My contribution is formatted in line with CODING_STANDARD.md.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • White-space or formatting changes outside the feature-related changed lines are in commits of their own.

The semantics of this operation is highly machine-dependent, and thus, it's
difficult to use.  The single user is replaced by xor -1.
Copy link
Collaborator

@tautschnig tautschnig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but I do wonder whether it would be more suitable for the interpreter to turn the mp_integer into a bitvector, then do the operation on a bitvector, and turn the result back into an mp_integer. (But that would apply to all bit operations, not just the one touched here.)

@kroening
Copy link
Member Author

kroening commented Oct 6, 2018

You mean bitvector as in vector<bool>?

@tautschnig
Copy link
Collaborator

You mean bitvector as in vector<bool>?

No, I was thinking of result = simplify(bitnot_exprt(from_integer(value, type)), ns);

@kroening
Copy link
Member Author

kroening commented Oct 6, 2018

Ah; well, there's an entirely different interpreter that just uses simplify(). That could directly apply to expressions at the top-level, without the need to even split by expression.

@tautschnig
Copy link
Collaborator

Ah; well, there's an entirely different interpreter that just uses simplify(). That could directly apply to expressions at the top-level, without the need to even split by expression.

Maybe that's all that should be done? What's the point of the current implementation?

@kroening
Copy link
Member Author

kroening commented Oct 6, 2018

Another option is to the use parts of path-based symex that aren't symbolic.

@kroening
Copy link
Member Author

kroening commented Oct 6, 2018

(which in turn uses simplify()).

Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passed Diffblue compatibility checks (cbmc commit: d22e9b9).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/87102220

@kroening kroening merged commit c8f6829 into develop Oct 6, 2018
@kroening kroening deleted the bitwise_neg branch October 6, 2018 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants