Skip to content

Commit caabb8a

Browse files
committed
tweak to verify private types
1 parent 59a671d commit caabb8a

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

jscomp/runtime/caml_int64.ml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ let to_unsigned (x : nativeint) =
5454
x >>> 0
5555

5656
let mk ~lo ~hi = {lo = to_unsigned lo ; hi}
57-
57+
(*
58+
module N = struct
59+
type nonrec t = t = private { hi : nativeint; lo : nativeint ; }
60+
end
61+
open N
62+
*)
5863
let min_int = mk ~lo: 0n ~hi:(-0x80000000n)
5964

6065
let max_int =
@@ -111,7 +116,7 @@ let lsl_ ({lo; hi} as x) numBits =
111116
if numBits = 0 then
112117
x
113118
else if numBits >= 32 then
114-
{lo =0n; hi = Caml_nativeint_extern.shift_left lo (numBits - 32) }
119+
mk ~lo:0n ~hi:(Caml_nativeint_extern.shift_left lo (numBits - 32))
115120
else
116121
mk ~lo:(Caml_nativeint_extern.shift_left lo numBits)
117122
~hi:
@@ -413,8 +418,11 @@ let to_hex (x : int64) =
413418
else
414419
aux x_hi ^ Caml_utils.repeat pad "0" ^ lo
415420

421+
416422
let discard_sign (x : int64) : int64 =
417-
unsafe_to_int64 { (unsafe_of_int64 x) with hi = Caml_nativeint_extern.logand 0x7fff_ffffn (unsafe_of_int64 x).hi }
423+
let v = unsafe_of_int64 x in
424+
unsafe_to_int64
425+
{ v with hi = Caml_nativeint_extern.logand 0x7fff_ffffn v.hi }
418426

419427
(* >>> 0 does not change its bit representation
420428
it simply makes sure it is an unsigned integer

0 commit comments

Comments
 (0)