-
Notifications
You must be signed in to change notification settings - Fork 16
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
Bitvector bv%i
is broken
#38
Comments
I thought about it when writing it but from what I understand there will be problems only if a problem make use of bitvectors whose size is strictly greater than |
No, just a bitvector of size 62, it is the actual value of the bitvector that goes through |
|
Oh, indeed that's a problem. We'll have to write a manual conversion to strings in that case (I'd rather avoid depending on zarith for now if not absolutely necessary). |
So https://stackoverflow.com/a/11007021/1531323 for direct conversion to binary ? |
For reference the code with zarith (for COLIBRI I fixed it that way temporarily): let parse_extended_lit _env _ast s n =
assert (String.length s >= 2);
let s' = String.sub s 2 (String.length s - 2) in
match Z.of_string s' with
| exception Failure _ -> None
| z ->
let z = Z.rem z (Z.shift_left Z.one n) in
let s'' = Z.format (Printf.sprintf "%%0%ib" n) z in
Some (Type.Term (T.mk_bitv s'')) |
Yes, i'll try and implement it as soon as possible. |
Some offsets seems to be off in the conversion to a binary string. But more importantly it uses int_of_string which is limited to 63 bit. We need to handle any size. Two solutions:
What do you prefer?
The text was updated successfully, but these errors were encountered: