123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175moduletypeS=sigtypetvalzero:t(** Integer 0. *)valone:t(** Integer 1. *)valminus_one:t(** Integer (-1). *)valneg:t->t(** Unary negation. *)valadd:t->t->t(** Addition. *)valsub:t->t->t(** Subtraction. *)valmul:t->t->t(** Mulitplication. *)valdiv:t->t->t(** Integer division. Raise [Division_by_zero] if the second argument is zero.
This division rounds the real quotient of its arguments towrds zero. *)valrem:t->t->t(** Integer remainder. If [y] is not zero, the result of [rem x y] satisfies
the following property: [x = add (mul (div x y) y) (rem x y)]. if [y = 0],
[rem x y] raises [Division_by_zero]. *)valsucc:t->t(** Successor. [succ x] is [add x one]. *)valpred:t->t(** Predecessor. [pred x] is [sub x one]. *)valabs:t->t(** Return the absolute value its argument. *)valmax_int:t(** The greatest representable integer. *)valmin_int:t(** The smallest representable integer. *)vallogand:t->t->t(** Bitwise logical and. *)vallogor:t->t->t(** Bitwise logical or. *)vallogxor:t->t->t(** Bitwise logical exclusive or. *)vallognot:t->t(** Bitwise logical negation. *)valshift_left:t->int->t(** [shift_left x y] shifts [x] to the left by [y] bits. The result is
unspecified if [y < 0] or [y >= (32 || 63)]. *)valshift_right:t->int->t(** [shift_right x y] shifts [x] to the right by [y] bits. This is an
arithmetic shift: the sign bit of [x] is replicated and inserted in the
vacated bits. The result is unspecified if [y < 0] or [y >= (32 || 63)]. *)valshift_right_logical:t->int->t(** [shift_right_logical x y] shifts [x] to the right by [y] bits. This is a
logical shift: zeroes are inserted in the vacated bits regardless of the
sign of [x] / The result is unspecified if [y < 0] or [y >= (32 || 63)]. *)valof_int:int->t(** Convert the given integer (type [int] ) to {!t}. It's an unsafe function
whose semantic is different from architecture. *)valto_int:t->int(** Convert the given {!t} integer to an integer (type [int] ). On 64-bit
platforms, the conversion is exact. On 32-bit platforms, the 32-bit
integer is taken modulo 2 {^ 31}, i.e. the high-order bit is lost during
the conversion. *)valof_int32:int32->t(** Convert the given 32-bit integer (type [int32]) to {!t} integer. It's an
unsafe function whose semantic is different from architecture. *)valto_int32:t->int32(** Convert the given {!t} integer to a 32-bit integer. *)valof_int64:int64->t(** Convert the given 64-bit integer (type [int64]) to {!t} integer. *)valto_int64:t->int64(** Covert the given {!t} integer to a 64-bit integer. *)valof_float:float->t(** Convert the given floating-point number to a {!t} integer, discarding the
fractional part (truncate towards 0). The result of the conversion is
undefined if, after truncation, the number is outside the range
{!min_int}, {!max_int}. *)valto_float:t->float(** Convert the given {!t} integer to a floating-point number. *)valof_string:string->t(** Convert the given string to a {!t} integer. The string is read in decimal
(by default, or if the string begins with [0u]) or in hexadecimal, octal
or binary if the string begins with [0x], [0o] or [0b] respectively.
The [0u] prefix reads the input as an unsigned integer in the range
[\[0, 2 * max_int + 1\]]. If the input exceeds {!max_int} it is converted
to the signed integer [min_int + input - max_int - 1].
The [_] (underscore) character can appear anywhere in the string is
ignored. Raise [Failure _] if the given string is not a valid
representation of an integer, or if the integer represented exceeds the
range of integer, or if the integer represented exceeds the range of
integers representable in type {!t}. *)valof_string_opt:string->toption(** Same as [of_string], but return [None] instead of raising. *)valto_string:t->string(** Return the string representation of its argument, in decimal. *)valcompare:t->t->int(** The comparison function for {!t} integers, with the same specification as
{!Stdlib.compare}. Along with the type [t], this function [compare] allows
the module [Optint] to be passed as argument to the functors {!Set.Make}
and {!Map.Make}. *)valequal:t->t->bool(** The equal function for {!t}. *)valpp:Format.formatter->t->unit(** The pretty-printer for {!t}. *)(** {2 Encoding functions}
Efficient fixed-length big-endian encoding functions for {!t} integers: *)valencode:bytes->off:int->t->unitvaldecode:string->off:int->tvalencoded_size:int(** The number of bytes in the {{!encode} encoded} form of {!t}. *)valto_unsigned_int32:t->int32valof_unsigned_int32:int32->tvalto_unsigned_int:t->intvalof_unsigned_int:int->tmoduleInfix:sigval(+):t->t->tval(-):t->t->tval(*):t->t->tval(%):t->t->tval(/):t->t->tval(land):t->t->tval(lor):t->t->tval(lsr):t->int->tval(lsl):t->int->tval(&&):t->t->t[@@ocaml.deprecated"Please use ( land )."]val(||):t->t->t[@@ocaml.deprecated"Please use ( lor )."]val(>>):t->int->t[@@ocaml.deprecated"Please use ( lsr )."]val(<<):t->int->t[@@ocaml.deprecated"Please use ( lsl )."]endend