-
Notifications
You must be signed in to change notification settings - Fork 237
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
FStar.BV: expose bvshl, bvshr and bvmod with bit vector rhs #3116
Conversation
No problem with using PRs to check this, but |
Thanks Guido, |
Sorry, I marked it as "ready to review", but it's not actually encoding the new bvshl' operator correctly yet. |
The bit-shifting and modulus operations in FStar.BV currently take natural numbers in the right-hand side. This incurs some conversion overhead, as the SMT-LIB primitives take bit vectors. This commit implements bit vector native versions called `bvshl'`, `bvshr'` and `bvmod_unsafe`.
The SMT encoding for bvdiv_unsafe was wrapping the bit vector argument in a boxed BV and then unwrapping as an int. I have fixed this and added a test.
I think this is ready for review now. I'll ping @nikswamy too since we discussed this on Slack earlier. I've added new binary functions that take two bit vectors: I am not convinced about the names (I was also not sure where to put the test. It's not really a bug report, but I couldn't see a better place for it.) |
Many thanks Amos! I just made a couple of small fixes and merged this. I also checked that this didn't cause any regressions in the related projects in the Everest repo. As a next step, it might be worth considering a breaking change that swaps the names around to make the primed version of the operators the default ... but that's for another day. |
Thanks Nik! |
The bit-shifting and modulus operations in FStar.BV currently take natural numbers in the right-hand side. This incurs some conversion overhead, as the SMT-LIB primitives take bit vectors. This commit implements bit vector native versions called
bvshl'
,bvshr'
andbvmod_unsafe
.