stdlib: add a few references to Sys.int_size inside docstrings (#1572)

master
Max Mouratov 2018-03-01 22:54:24 +05:00 committed by Alain Frisch
parent bfbb674fb1
commit ae2af8920a
2 changed files with 16 additions and 19 deletions

View File

@ -242,8 +242,8 @@ external ( @@ ) : ('a -> 'b) -> 'a -> 'b = "%apply"
(** {1 Integer arithmetic} *)
(** Integers are 31 bits wide (or 63 bits on 64-bit processors).
All operations are taken modulo 2{^31} (or 2{^63}).
(** Integers are [Sys.int_size] bits wide.
All operations are taken modulo 2{^[Sys.int_size]}.
They do not fail on overflow. *)
external ( ~- ) : int -> int = "%negint"
@ -325,22 +325,20 @@ val lnot : int -> int
external ( lsl ) : int -> int -> int = "%lslint"
(** [n lsl m] shifts [n] to the left by [m] bits.
The result is unspecified if [m < 0] or [m >= bitsize],
where [bitsize] is [32] on a 32-bit platform and
[64] on a 64-bit platform.
The result is unspecified if [m < 0] or [m > Sys.int_size].
Right-associative operator at precedence level 8/11. *)
external ( lsr ) : int -> int -> int = "%lsrint"
(** [n lsr m] shifts [n] to the right by [m] bits.
This is a logical shift: zeroes are inserted regardless of
the sign of [n].
The result is unspecified if [m < 0] or [m >= bitsize].
The result is unspecified if [m < 0] or [m > Sys.int_size].
Right-associative operator at precedence level 8/11. *)
external ( asr ) : int -> int -> int = "%asrint"
(** [n asr m] shifts [n] to the right by [m] bits.
This is an arithmetic shift: the sign bit of [n] is replicated.
The result is unspecified if [m < 0] or [m >= bitsize].
The result is unspecified if [m < 0] or [m > Sys.int_size].
Right-associative operator at precedence level 8/11. *)

View File

@ -132,10 +132,9 @@ val word_size : int
program, in bits: 32 or 64. *)
val int_size : int
(** Size of an int. It is 31 bits (resp. 63 bits) when using the
OCaml compiler on a 32 bits (resp. 64 bits) platform. It may
differ for other compilers, e.g. it is 32 bits when compiling to
JavaScript.
(** Size of [int], in bits. It is 31 (resp. 63) when using OCaml on a
32-bit (resp. 64-bit) platform. It may differ for other implementations,
e.g. it can be 32 bits when compiling to JavaScript.
@since 4.03.0 *)
val big_endian : bool