File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed
Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -31,10 +31,6 @@ let max_int_ (Offset offset) = Int32.shift_right Int32.max_int offset
3131
3232let min_int_ (Offset offset ) = Int32. shift_right Int32. min_int offset
3333
34- let min_int_i offset = Int32. to_int (min_int_ offset)
35-
36- let max_int_i offset = Int32. to_int (max_int_ offset)
37-
3834let min_int () =
3935 let offset = offset () in
4036 min_int_ offset
@@ -50,7 +46,7 @@ let to_float x = Int32.to_float x
5046let to_int32 x = x
5147
5248let to_int_exn x =
53- if Sys. int_size < = 32 || Int32. of_int Int. min_int < = x || x < = Int32. of_int Int. max_int
49+ if Sys. int_size > = 32 || Int32. of_int Int. min_int < = x || x < = Int32. of_int Int. max_int
5450 then Int32. to_int x
5551 else failwith " to_int_exn"
5652
@@ -102,9 +98,10 @@ let is_zero x = equal x 0l
10298
10399let of_int_exn (x : int ) =
104100 let offset = offset () in
105- if min_int_i offset < = x && x < = max_int_i offset
101+ if Sys. int_size < = 32
102+ || (Int32. to_int (min_int_ offset) < = x && x < = Int32. to_int (max_int_ offset))
106103 then Int32. of_int x
107- else failwith " of_int_exn"
104+ else failwith ( Printf. sprintf " of_int_exn(%d) " x)
108105
109106let of_int32_exn (x : int32 ) =
110107 let offset = offset () in
You can’t perform that action at this time.
0 commit comments