@@ -288,137 +288,6 @@ module Nativeint = struct
288288 external equal : nativeint -> nativeint -> bool = " %equal"
289289end
290290
291- module Targetint : sig
292- type t
293-
294- val equal : t -> t -> bool
295-
296- val compare : t -> t -> int
297-
298- val to_string : t -> string
299-
300- val to_int_exn : t -> int
301-
302- val to_float : t -> float
303-
304- val of_string : string -> t
305-
306- val of_float : float -> t
307-
308- val of_int_exn : int -> t
309-
310- val of_int32_warning_on_overflow : int32 -> t
311-
312- val of_nativeint_warning_on_overflow : nativeint -> t
313-
314- val of_int_warning_on_overflow : int -> t
315-
316- val succ : t -> t
317-
318- val add : t -> t -> t
319-
320- val sub : t -> t -> t
321-
322- val mul : t -> t -> t
323-
324- val div : t -> t -> t
325-
326- val rem : t -> t -> t
327-
328- val logand : t -> t -> t
329-
330- val logor : t -> t -> t
331-
332- val logxor : t -> t -> t
333-
334- val shift_left : t -> int -> t
335-
336- val shift_right : t -> int -> t
337-
338- val shift_right_logical : t -> int -> t
339-
340- val neg : t -> t
341-
342- val abs : t -> t
343-
344- val ( > = ) : t -> t -> bool
345-
346- val ( < = ) : t -> t -> bool
347-
348- val ( < ) : t -> t -> bool
349-
350- val ( > ) : t -> t -> bool
351-
352- val ( = ) : t -> t -> bool
353-
354- val ( <> ) : t -> t -> bool
355-
356- val is_zero : t -> bool
357-
358- val num_bits : int
359-
360- val zero : t
361-
362- val one : t
363- end = struct
364- include Int32
365-
366- let num_bits = 32
367-
368- let is_zero x = equal x 0l
369-
370- let of_int_exn x = of_int x
371-
372- let to_int_exn x = to_int x
373-
374- external ( < ) : int32 -> int32 -> bool = " %lessthan"
375-
376- external ( < = ) : int32 -> int32 -> bool = " %lessequal"
377-
378- external ( <> ) : int32 -> int32 -> bool = " %notequal"
379-
380- external ( = ) : int32 -> int32 -> bool = " %equal"
381-
382- external ( > ) : int32 -> int32 -> bool = " %greaterthan"
383-
384- external ( > = ) : int32 -> int32 -> bool = " %greaterequal"
385-
386- let warn_overflow ~to_dec ~to_hex i i32 =
387- warn
388- " Warning: integer overflow: integer 0x%s (%s) truncated to 0x%lx (%ld); the \
389- generated code might be incorrect.@."
390- (to_hex i)
391- (to_dec i)
392- i32
393- i32
394-
395- let convert_warning_on_overflow ~to_int32 ~of_int32 ~equal ~to_dec ~to_hex x =
396- let i32 = to_int32 x in
397- let x' = of_int32 i32 in
398- if not (equal x' x) then warn_overflow ~to_dec ~to_hex x i32;
399- i32
400-
401- let of_int_warning_on_overflow i =
402- convert_warning_on_overflow
403- ~to_int32: Int32. of_int
404- ~of_int32: Int32. to_int
405- ~equal: Int_replace_polymorphic_compare. ( = )
406- ~to_dec: (Printf. sprintf " %d" )
407- ~to_hex: (Printf. sprintf " %x" )
408- i
409-
410- let of_int32_warning_on_overflow i = i
411-
412- let of_nativeint_warning_on_overflow n =
413- convert_warning_on_overflow
414- ~to_int32: Nativeint. to_int32
415- ~of_int32: Nativeint. of_int32
416- ~equal: Nativeint. equal
417- ~to_dec: (Printf. sprintf " %nd" )
418- ~to_hex: (Printf. sprintf " %nx" )
419- n
420- end
421-
422291module Option = struct
423292 let map ~f x =
424293 match x with
0 commit comments