openSexplib.StdopenBin_prot.StdopenCommonmoduleT=structtypet=intwithbin_io,sexp(* According to estokes, if i = j then 0 else if i < j then -1 else 1 is only slightly faster, so we've decided to stick with Pervasives.compare *)letcompare(x:t)y=comparexyletequal(x:t)y=x=ylethash(x:t)=Hashtbl.hashxletof_strings=tryint_of_stringswith|_->failwithf"Int.of_string: %S"s()letto_string=string_of_intendincludeTletnum_bits=Word_size.num_bitsWord_size.word_size-1letof_float=int_of_floatletto_float=float_of_intletmin(x:t)y=ifx<ythenxelseyletmax(x:t)y=ifx>ythenxelseyletascending=compareletdescendingxy=compareyxletequal(x:t)y=x=ylet(>=)(x:t)y=x>=ylet(<=)(x:t)y=x<=ylet(=)(x:t)y=x=ylet(>)(x:t)y=x>ylet(<)(x:t)y=x<ylet(<>)(x:t)y=x<>yincludeHashable.Make_binable(T)moduleMap=Core_map.Make(T)moduleSet=Core_set.Make(T)letzero=0letone=1letminus_one=-1letpredi=i-1letsucci=i+1letto_inti=iletto_int_exn=to_intletof_inti=iletof_int_exn=of_intletmax_value=max_intletmin_value=min_intmoduleConv=Int_conversionsletof_int32=Conv.int32_to_intletof_int32_exn=Conv.int32_to_int_exnletto_int32=Conv.int_to_int32letto_int32_exn=Conv.int_to_int32_exnletof_int64=Conv.int64_to_intletof_int64_exn=Conv.int64_to_int_exnletto_int64=Conv.int_to_int64letof_nativeint=Conv.nativeint_to_intletof_nativeint_exn=Conv.nativeint_to_int_exnletto_nativeint=Conv.int_to_nativeintletto_nativeint_exn=to_nativeintincludeConv.Make(T)letabsx=absxlet(+)xy=(+)xylet(-)xy=(-)xylet(*)xy=(*)xylet(/)xy=(/)xymoduleInfix=structlet(%)xy=ify<=0theninvalid_argf"%d %% %d in core_int.ml: modulus should be positive"xy();letrval=xmodyinifrval<0thenrval+yelservallet(/%)xy=ify<=0theninvalid_argf"%d /%% %d in core_int.ml: divisor should be positive"xy();ifx<0then(x+1)/y-1elsex/y(** float division of integers *)let(//)xy=floatx/.floatyendletnegx=-xletremab=amodbletincr=Pervasives.incrletdecr=Pervasives.decrletshift_rightab=aasrbletshift_right_logicalab=alsrbletshift_leftab=alslbletbit_nota=lnotaletbit_orab=alorbletbit_andab=alandbletbit_xorab=alxorblet(<<)ab=shift_leftablet(>>)ab=shift_rightablet(~>>)ab=shift_right_logicalab