1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465# 2 "int.ml"(**************************************************************************)(* *)(* OCaml *)(* *)(* The OCaml programmers *)(* *)(* Copyright 2018 Institut National de Recherche en Informatique et *)(* en Automatique. *)(* *)(* All rights reserved. This file is distributed under the terms of *)(* the GNU Lesser General Public License version 2.1, with the *)(* special exception on linking described in the file LICENSE. *)(* *)(**************************************************************************)open!Stdlib[@@@ocaml.flambda_o3]typet=intletzero=0letone=1letminus_one=-1externalneg:(int[@local_opt])->int@@portable="%negint"externaladd:(int[@local_opt])->(int[@local_opt])->int@@portable="%addint"externalsub:(int[@local_opt])->(int[@local_opt])->int@@portable="%subint"externalmul:(int[@local_opt])->(int[@local_opt])->int@@portable="%mulint"externaldiv:(int[@local_opt])->(int[@local_opt])->int@@portable="%divint"externalrem:(int[@local_opt])->(int[@local_opt])->int@@portable="%modint"externalsucc:(int[@local_opt])->int@@portable="%succint"externalpred:(int[@local_opt])->int@@portable="%predint"letabsx=ifx>=0thenxelse-xletmax_int=(-1)lsr1letmin_int=max_int+1externallogand:(int[@local_opt])->(int[@local_opt])->int@@portable="%andint"externallogor:(int[@local_opt])->(int[@local_opt])->int@@portable="%orint"externallogxor:(int[@local_opt])->(int[@local_opt])->int@@portable="%xorint"letlognotx=logxorx(-1)externalshift_left:(int[@local_opt])->(int[@local_opt])->int@@portable="%lslint"externalshift_right:(int[@local_opt])->(int[@local_opt])->int@@portable="%asrint"externalshift_right_logical:(int[@local_opt])->(int[@local_opt])->int@@portable="%lsrint"letequal:int->int->bool=(=)letcompare:int->int->int=Stdlib.compareletminxy:t=ifx<=ythenxelseyletmaxxy:t=ifx>=ythenxelseyexternalto_float:(int[@local_opt])->(float[@local_opt])@@portable="%floatofint"externalof_float:(float[@local_opt])->int@@portable="%intoffloat"(*
external int_of_string : string -> int = "caml_int_of_string"
let of_string s = try Some (int_of_string s) with Failure _ -> None
*)externalformat_int:string->int->string@@portable="caml_format_int"letto_stringx=format_int"%d"x(* [caml_hash_exn] doesn't raise on ints, so it's safe for
it to be marked as [@@noalloc].
*)externalseeded_hash_param:int->int->int->int->int@@portable="caml_hash_exn"[@@noalloc]letseeded_hashseedx=seeded_hash_param10100seedxlethashx=seeded_hash_param101000x