123456789101112131415161718192021222324252627282930313233343536(* [Int0] defines integer functions that are primitives or can be simply defined in terms
of [Stdlib]. [Int0] is intended to completely express the part of [Stdlib] that [Base]
uses for integers -- no other file in Base other than int0.ml should use these
functions directly through [Stdlib]. [Int0] has few dependencies, and so is available
early in Base's build order.
All Base files that need to use ints and come before [Base.Int] in build order should
do:
{[
module Int = Int0
]}
Defining [module Int = Int0] is also necessary because it prevents ocamldep from
mistakenly causing a file to depend on [Base.Int]. *)externalformat:string@local->int->string@@portable="caml_format_int"let%templateto_string(local_n)=(Integer_to_string.int_to_string[@alloca])n[@exclave_if_stacka][@@alloca=(heap,stack)];;externalof_string:string@local->int@@portable="caml_int_of_string"letof_string_opt(local_s)=trySome(of_strings)with|Failure_->None;;letto_float=Stdlib.float_of_intletof_float=Stdlib.int_of_floatletmax_value=Stdlib.max_intletmin_value=Stdlib.min_intletsucc=Stdlib.succletpred=Stdlib.pred