CCNativeint(cleanup): cleanup with bump ocaml version to 4.08

This commit is contained in:
Emmanuel Arrighi 2026-02-06 11:28:06 +01:00
parent 571f9f3793
commit 5e60c0d237
2 changed files with 13 additions and 9 deletions

View file

@ -2,8 +2,13 @@
include Nativeint
[@@@iflt 4.13]
let min : t -> t -> t = Stdlib.min
let max : t -> t -> t = Stdlib.max
[@@@endif]
let hash x = Stdlib.abs (to_int x)
let sign i = compare i zero
@ -95,8 +100,7 @@ let random_range i j st = add i (random (sub j i) st)
(** {2 Conversion} *)
let of_string_exn = of_string
let of_string x = try Some (of_string_exn x) with Failure _ -> None
let of_string_opt = of_string
let of_string = of_string_opt
let most_significant_bit = logxor (neg 1n) (shift_right_logical (neg 1n) 1)
type output = char -> unit

View file

@ -2,14 +2,14 @@
(** Helpers for processor-native integers
This module provides operations on the type [nativeint] of signed 32-bit integers
(on 32-bit platforms) or signed 64-bit integers (on 64-bit platforms).
This integer type has exactly the same width as that of a pointer type in the C compiler.
All arithmetic operations over nativeint are taken modulo 2{^32} or 2{^64} depending
This module provides operations on the type [nativeint] of signed 32-bit integers
(on 32-bit platforms) or signed 64-bit integers (on 64-bit platforms).
This integer type has exactly the same width as that of a pointer type in the C compiler.
All arithmetic operations over nativeint are taken modulo 2{^32} or 2{^64} depending
on the word size of the architecture.
Performance notice: values of type [nativeint] occupy more memory space than values of type [int],
and arithmetic operations on [nativeint] are generally slower than those on [int].
Performance notice: values of type [nativeint] occupy more memory space than values of type [int],
and arithmetic operations on [nativeint] are generally slower than those on [int].
Use [nativeint] only when the application requires the extra bit of precision over the [int] type.
@since 2.1 *)
@ -117,7 +117,7 @@ val pp_binary : t printer
module Infix : sig
val ( + ) : t -> t -> t
(** [x + y] is the sum of [x] and [y].
(** [x + y] is the sum of [x] and [y].
Addition. *)
val ( - ) : t -> t -> t