Data_encoding: better documentation of int
This commit is contained in:
parent
02beb9c79a
commit
1af07b233a
@ -548,7 +548,7 @@ module Encoding = struct
|
||||
let ranged_int minimum maximum =
|
||||
let minimum = min minimum maximum
|
||||
and maximum = max minimum maximum in
|
||||
if minimum < ~-1_073_741_824 || 1_073_741_823 < maximum then
|
||||
if minimum < -(1 lsl 30) || (1 lsl 30) - 1 < maximum then
|
||||
invalid_arg "Data_encoding.ranged_int" ;
|
||||
make @@ RangedInt { minimum ; maximum }
|
||||
let ranged_float minimum maximum =
|
||||
|
@ -109,7 +109,12 @@ val int32 : int32 encoding
|
||||
(data is encodedas a 64-bit int in binary and a decimal string in JSON). *)
|
||||
val int64 : int64 encoding
|
||||
|
||||
(** Integer with bounds in a given range. Both bounds are inclusive *)
|
||||
(** Integer with bounds in a given range. Both bounds are inclusive.
|
||||
|
||||
Raises [Invalid_argument] if the bounds are beyond the interval
|
||||
[-2^30; 2^30-1]. These bounds are chosen to be compatible with all versions
|
||||
of OCaml.
|
||||
*)
|
||||
val ranged_int : int -> int -> int encoding
|
||||
|
||||
(** Float with bounds in a given range. Both bounds are inclusive *)
|
||||
|
Loading…
Reference in New Issue
Block a user