Skip to content
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

Bit manipulation for Big_int #4641

vicuna opened this Issue Nov 7, 2008 · 1 comment


None yet
2 participants
Copy link

vicuna commented Nov 7, 2008

Original bug ID: 4641
Reporter: andrejbauer
Assigned to: @xavierleroy
Status: closed (set by @xavierleroy on 2011-05-29T10:14:20Z)
Resolution: fixed
Priority: normal
Severity: feature
Version: 3.10.2
Fixed in version: 3.12.0+dev
Category: ~DO NOT USE (was: OCaml general)
Related to: #4652
Monitored by: yoiwa

Bug description

The Big_int module in the Num library would benefit greatly from two simple additions: functions which can shift numbers left and right a given number of bits (the equivalent of asl, lsl, asr, lsr for the type int). Please consider adding them. I am willing to write a patch if someone tells me they will consider it.

Additional information

I am implementing real number computation in Ocaml, for which I am using the MPFR library. Since MPFR is hard to compile and link with Ocaml (requires a bunch of other tools and libraries), I have decided to reimplement dyadic rationals in "pure" Ocaml. To my shock I discovered that the Big_int package doesn't have the bit shifting operations. So now I have to divide by powers of two, which is really inefficient.


This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Apr 1, 2009

Comment author: @xavierleroy

On the CVS trunk, I added big_int implementations for bitwise operations, shifts, and bit extraction. More testing is welcome. If all goes well, this will be released in 3.12.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.