(** Conversions from unsigned longs can be expressed in terms of conversions from signed longs. If the unsigned long is too big, a round-to-odd must be performed on it to avoid double rounding. *)

(* Specifications: *)
Theorem of_longu_of_long_1:
forall x,
Int64.ltu x (Int64.repr Int64.half_modulus) = true ->
of_longu x = of_long x.
Theorem of_longu_of_long_2:
forall x,
Int64.ltu x (Int64.repr Int64.half_modulus) = false ->
of_longu x = mul (of_long (Int64.or (Int64.shru x Int64.one)
(Int64.and x Int64.one)))
(of_int (Int.repr 2)).
Theorem of_longu_of_long_1:
forall x,
Int64.ltu x (Int64.repr Int64.half_modulus) = true ->
of_longu x = of_long x.
Theorem of_longu_of_long_2:
forall x,
Int64.ltu x (Int64.repr Int64.half_modulus) = false ->
of_longu x = mul (of_long (Int64.or (Int64.shru x Int64.one)
(Int64.and x Int64.one)))
(of_int (Int.repr 2)).