ocaml-uint icon indicating copy to clipboard operation
ocaml-uint copied to clipboard

Create Uint128 out of 2 Uint64

Open johanmazel opened this issue 9 years ago • 2 comments

Could you add this feature ? If you cannot, I can probably code this and try a pull request.

johanmazel avatar May 28 '15 12:05 johanmazel

Hi Johan

Would conversions from the other uint types to uint128 be enough? Then you could implement it with something like

let uint128_of_two_uint64 x y =
  let (||) = Uint128.logor in
  let (<<) = Uint128.shift_left in
  let u128 = Uint128.of_uint64 in
  (u128 x << 64) || u128 y

The Uint128.of_uint64 function doesn't exist, but it would be trivial to add.

Cheers, Andre

On Thu, May 28, 2015 at 9:58 AM, johanmazel [email protected] wrote:

Could you add this feature ? If you cannot, I can probably code this and try a pull request.

— Reply to this email directly or view it on GitHub https://github.com/andrenth/ocaml-uint/issues/10.

andrenth avatar May 29 '15 13:05 andrenth

Yes, that would be perfect. Could you also add a uint64_of_two_uint32 function ? And maybe a uint128_of_four_uint32 function ?

johanmazel avatar May 30 '15 10:05 johanmazel