From 5d71157b5f0e0fef85a8efc8c0923b50fe2cf590 Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Mon, 16 Oct 2023 15:44:45 +0200 Subject: [PATCH 1/6] Build: enable warning 58 --- dune-workspace | 2 +- manifest/main.ml | 4 +--- src/lib_protocol_compiler/dune | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/dune-workspace b/dune-workspace index c974bd8fff59..f91d3cf6b85c 100644 --- a/dune-workspace +++ b/dune-workspace @@ -2,7 +2,7 @@ (env (dev - (flags (:standard -w @1..72-4-40..42-44-45-48-58-60-67-69-70)) + (flags (:standard -w @1..72-4-40..42-44-45-48-60-67-69-70)) (js_of_ocaml (runtest_alias runtest_js))) (release (js_of_ocaml (runtest_alias runtest_js)) diff --git a/manifest/main.ml b/manifest/main.ml index f86a6f47a589..667cddfcea43 100644 --- a/manifest/main.ml +++ b/manifest/main.ml @@ -27,8 +27,7 @@ open Manifest -let warnings_disabled_by_default = - [4; 40; 41; 42; 44; 45; 48; 58; 60; 67; 69; 70] +let warnings_disabled_by_default = [4; 40; 41; 42; 44; 45; 48; 60; 67; 69; 70] (* 4 [fragile-match] 40 [name-out-of-scope] @@ -37,7 +36,6 @@ let warnings_disabled_by_default = 44 [open-shadow-identifier] 45 [open-shadow-label-constructor] 48 [eliminated-optional-arguments] - 58 [no-cmx-file] (flambda specific, necessary as long as Zarith_version.cmx is not installed) 60 [unused-module] 67 [unused-functor-parameter] 69 [unused-field] diff --git a/src/lib_protocol_compiler/dune b/src/lib_protocol_compiler/dune index 9e4300a4f68f..24d95fdc0a25 100644 --- a/src/lib_protocol_compiler/dune +++ b/src/lib_protocol_compiler/dune @@ -67,7 +67,7 @@ (action (write-file %{targets} - "let warnings = \"+a-4-40..42-44-45-48-58-60-67-69-70\""))) + "let warnings = \"+a-4-40..42-44-45-48-60-67-69-70\""))) (library (name octez_protocol_compiler_native) -- GitLab From 6516c4246b088d02bc478741d7d9a9629180ba91 Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Mon, 16 Oct 2023 16:18:19 +0200 Subject: [PATCH 2/6] Proto-env: remove Z.extract* from unactive envs necessary to bump zarith version --- manifest/main.ml | 2 +- opam/bls12-381.opam | 2 +- opam/octez-l2-libs.opam | 2 +- opam/octez-libs.opam | 2 +- opam/octez-proto-libs.opam | 2 +- opam/tezos-micheline-rewriting.opam | 2 +- opam/virtual/octez-deps.opam | 2 +- src/lib_protocol_environment/sigs/v1.ml | 15 --------------- src/lib_protocol_environment/sigs/v1/z.mli | 15 --------------- src/lib_protocol_environment/sigs/v10.ml | 15 --------------- src/lib_protocol_environment/sigs/v10/z.mli | 15 --------------- src/lib_protocol_environment/sigs/v2.ml | 15 --------------- src/lib_protocol_environment/sigs/v2/z.mli | 15 --------------- src/lib_protocol_environment/sigs/v3.ml | 15 --------------- src/lib_protocol_environment/sigs/v3/z.mli | 15 --------------- src/lib_protocol_environment/sigs/v4.ml | 15 --------------- src/lib_protocol_environment/sigs/v4/z.mli | 15 --------------- src/lib_protocol_environment/sigs/v5.ml | 15 --------------- src/lib_protocol_environment/sigs/v5/z.mli | 15 --------------- src/lib_protocol_environment/sigs/v6.ml | 15 --------------- src/lib_protocol_environment/sigs/v6/z.mli | 15 --------------- src/lib_protocol_environment/sigs/v7.ml | 15 --------------- src/lib_protocol_environment/sigs/v7/z.mli | 15 --------------- src/lib_protocol_environment/sigs/v8.ml | 15 --------------- src/lib_protocol_environment/sigs/v8/z.mli | 15 --------------- src/lib_protocol_environment/sigs/v9.ml | 15 --------------- src/lib_protocol_environment/sigs/v9/z.mli | 15 --------------- 27 files changed, 7 insertions(+), 307 deletions(-) diff --git a/manifest/main.ml b/manifest/main.ml index 667cddfcea43..49c9068b1c85 100644 --- a/manifest/main.ml +++ b/manifest/main.ml @@ -361,7 +361,7 @@ let zarith = external_lib ~js_compatible:true "zarith" - V.(at_least "1.12" && less_than "1.13") + V.(at_least "1.13" && less_than "1.14") let zarith_stubs_js = external_lib ~js_compatible:true "zarith_stubs_js" V.True diff --git a/opam/bls12-381.opam b/opam/bls12-381.opam index 768bcee44f94..a83297c88a2e 100644 --- a/opam/bls12-381.opam +++ b/opam/bls12-381.opam @@ -12,7 +12,7 @@ depends: [ "ocaml" { >= "4.14" } "integers" "integers_stubs_js" - "zarith" { >= "1.12" & < "1.13" } + "zarith" { >= "1.13" & < "1.14" } "zarith_stubs_js" "hex" { >= "1.3.0" } "tezt" { with-test & >= "4.0.0" & < "5.0.0" } diff --git a/opam/octez-l2-libs.opam b/opam/octez-l2-libs.opam index 812d073045c0..2eed0cc4e30a 100644 --- a/opam/octez-l2-libs.opam +++ b/opam/octez-l2-libs.opam @@ -12,7 +12,7 @@ depends: [ "ocaml" { >= "4.14" } "ppx_deriving" "octez-libs" - "zarith" { >= "1.12" & < "1.13" } + "zarith" { >= "1.13" & < "1.14" } "lwt" { >= "5.7.0" } "ctypes" { >= "0.18.0" } "ctypes-foreign" { >= "0.18.0" } diff --git a/opam/octez-libs.opam b/opam/octez-libs.opam index eb8702c1e7b5..da44684529a1 100644 --- a/opam/octez-libs.opam +++ b/opam/octez-libs.opam @@ -19,7 +19,7 @@ depends: [ "data-encoding" { >= "0.7.1" & < "1.0.0" } "ppx_expect" "hex" { >= "1.3.0" } - "zarith" { >= "1.12" & < "1.13" } + "zarith" { >= "1.13" & < "1.14" } "zarith_stubs_js" "aches" { >= "1.0.0" } "seqes" { >= "0.2" } diff --git a/opam/octez-proto-libs.opam b/opam/octez-proto-libs.opam index dcdd3a77549d..4fa844900825 100644 --- a/opam/octez-proto-libs.opam +++ b/opam/octez-proto-libs.opam @@ -14,7 +14,7 @@ depends: [ "octez-l2-libs" "data-encoding" { >= "0.7.1" & < "1.0.0" } "bls12-381" - "zarith" { >= "1.12" & < "1.13" } + "zarith" { >= "1.13" & < "1.14" } "zarith_stubs_js" "class_group_vdf" { >= "0.0.4" } "aches" { >= "1.0.0" } diff --git a/opam/tezos-micheline-rewriting.opam b/opam/tezos-micheline-rewriting.opam index 8add99b5a33b..de93934a0004 100644 --- a/opam/tezos-micheline-rewriting.opam +++ b/opam/tezos-micheline-rewriting.opam @@ -10,7 +10,7 @@ license: "MIT" depends: [ "dune" { >= "3.11.1" } "ocaml" { >= "4.14" } - "zarith" { >= "1.12" & < "1.13" } + "zarith" { >= "1.13" & < "1.14" } "zarith_stubs_js" "octez-libs" "tezt" { with-test & >= "4.0.0" & < "5.0.0" } diff --git a/opam/virtual/octez-deps.opam b/opam/virtual/octez-deps.opam index d484fd4e56c6..501667d327a9 100644 --- a/opam/virtual/octez-deps.opam +++ b/opam/virtual/octez-deps.opam @@ -107,7 +107,7 @@ depends: [ "uri" { >= "3.1.0" } "uutf" "yaml" { >= "3.1.0" } - "zarith" { >= "1.12" & < "1.13" } + "zarith" { >= "1.13" & < "1.14" } "zarith_stubs_js" ] conflicts: [ diff --git a/src/lib_protocol_environment/sigs/v1.ml b/src/lib_protocol_environment/sigs/v1.ml index 3d13f7ee82f2..823a15c132dd 100644 --- a/src/lib_protocol_environment/sigs/v1.ml +++ b/src/lib_protocol_environment/sigs/v1.ml @@ -2945,21 +2945,6 @@ val log2up: t -> int external size: t -> int = "ml_z_size" [@@noalloc] (** Returns the number of machine words used to represent the number. *) -external extract: t -> int -> int -> t = "ml_z_extract" -(** [extract a off len] returns a nonnegative number corresponding to bits - [off] to [off]+[len]-1 of [b]. - Negative [a] are considered in infinite-length 2's complement - representation. - *) - -val signed_extract: t -> int -> int -> t -(** [signed_extract a off len] extracts bits [off] to [off]+[len]-1 of [b], - as [extract] does, then sign-extends bit [len-1] of the result - (that is, bit [off + len - 1] of [a]). The result is between - [- 2{^[len]-1}] (included) and [2{^[len]-1}] (excluded), - and equal to [extract a off len] modulo [2{^len}]. - *) - external to_bits: t -> string = "ml_z_to_bits" (** Returns a binary representation of the argument. The string result should be interpreted as a sequence of bytes, diff --git a/src/lib_protocol_environment/sigs/v1/z.mli b/src/lib_protocol_environment/sigs/v1/z.mli index b31519b72628..5361baec1fa4 100644 --- a/src/lib_protocol_environment/sigs/v1/z.mli +++ b/src/lib_protocol_environment/sigs/v1/z.mli @@ -435,21 +435,6 @@ val log2up: t -> int external size: t -> int = "ml_z_size" [@@noalloc] (** Returns the number of machine words used to represent the number. *) -external extract: t -> int -> int -> t = "ml_z_extract" -(** [extract a off len] returns a nonnegative number corresponding to bits - [off] to [off]+[len]-1 of [b]. - Negative [a] are considered in infinite-length 2's complement - representation. - *) - -val signed_extract: t -> int -> int -> t -(** [signed_extract a off len] extracts bits [off] to [off]+[len]-1 of [b], - as [extract] does, then sign-extends bit [len-1] of the result - (that is, bit [off + len - 1] of [a]). The result is between - [- 2{^[len]-1}] (included) and [2{^[len]-1}] (excluded), - and equal to [extract a off len] modulo [2{^len}]. - *) - external to_bits: t -> string = "ml_z_to_bits" (** Returns a binary representation of the argument. The string result should be interpreted as a sequence of bytes, diff --git a/src/lib_protocol_environment/sigs/v10.ml b/src/lib_protocol_environment/sigs/v10.ml index 4462553c5345..e44d0ac90ce9 100644 --- a/src/lib_protocol_environment/sigs/v10.ml +++ b/src/lib_protocol_environment/sigs/v10.ml @@ -2857,21 +2857,6 @@ val log2up: t -> int external size: t -> int = "ml_z_size" [@@noalloc] (** Returns the number of machine words used to represent the number. *) -external extract: t -> int -> int -> t = "ml_z_extract" -(** [extract a off len] returns a nonnegative number corresponding to bits - [off] to [off]+[len]-1 of [b]. - Negative [a] are considered in infinite-length 2's complement - representation. - *) - -val signed_extract: t -> int -> int -> t -(** [signed_extract a off len] extracts bits [off] to [off]+[len]-1 of [b], - as [extract] does, then sign-extends bit [len-1] of the result - (that is, bit [off + len - 1] of [a]). The result is between - [- 2{^[len]-1}] (included) and [2{^[len]-1}] (excluded), - and equal to [extract a off len] modulo [2{^len}]. - *) - external to_bits: t -> string = "ml_z_to_bits" (** Returns a binary representation of the argument. The string result should be interpreted as a sequence of bytes, diff --git a/src/lib_protocol_environment/sigs/v10/z.mli b/src/lib_protocol_environment/sigs/v10/z.mli index bc93f0cdcd0a..adbc20dbe812 100644 --- a/src/lib_protocol_environment/sigs/v10/z.mli +++ b/src/lib_protocol_environment/sigs/v10/z.mli @@ -435,21 +435,6 @@ val log2up: t -> int external size: t -> int = "ml_z_size" [@@noalloc] (** Returns the number of machine words used to represent the number. *) -external extract: t -> int -> int -> t = "ml_z_extract" -(** [extract a off len] returns a nonnegative number corresponding to bits - [off] to [off]+[len]-1 of [b]. - Negative [a] are considered in infinite-length 2's complement - representation. - *) - -val signed_extract: t -> int -> int -> t -(** [signed_extract a off len] extracts bits [off] to [off]+[len]-1 of [b], - as [extract] does, then sign-extends bit [len-1] of the result - (that is, bit [off + len - 1] of [a]). The result is between - [- 2{^[len]-1}] (included) and [2{^[len]-1}] (excluded), - and equal to [extract a off len] modulo [2{^len}]. - *) - external to_bits: t -> string = "ml_z_to_bits" (** Returns a binary representation of the argument. The string result should be interpreted as a sequence of bytes, diff --git a/src/lib_protocol_environment/sigs/v2.ml b/src/lib_protocol_environment/sigs/v2.ml index fb8b992a9ba4..3970a734e8cf 100644 --- a/src/lib_protocol_environment/sigs/v2.ml +++ b/src/lib_protocol_environment/sigs/v2.ml @@ -2979,21 +2979,6 @@ val log2up: t -> int external size: t -> int = "ml_z_size" [@@noalloc] (** Returns the number of machine words used to represent the number. *) -external extract: t -> int -> int -> t = "ml_z_extract" -(** [extract a off len] returns a nonnegative number corresponding to bits - [off] to [off]+[len]-1 of [b]. - Negative [a] are considered in infinite-length 2's complement - representation. - *) - -val signed_extract: t -> int -> int -> t -(** [signed_extract a off len] extracts bits [off] to [off]+[len]-1 of [b], - as [extract] does, then sign-extends bit [len-1] of the result - (that is, bit [off + len - 1] of [a]). The result is between - [- 2{^[len]-1}] (included) and [2{^[len]-1}] (excluded), - and equal to [extract a off len] modulo [2{^len}]. - *) - external to_bits: t -> string = "ml_z_to_bits" (** Returns a binary representation of the argument. The string result should be interpreted as a sequence of bytes, diff --git a/src/lib_protocol_environment/sigs/v2/z.mli b/src/lib_protocol_environment/sigs/v2/z.mli index b31519b72628..5361baec1fa4 100644 --- a/src/lib_protocol_environment/sigs/v2/z.mli +++ b/src/lib_protocol_environment/sigs/v2/z.mli @@ -435,21 +435,6 @@ val log2up: t -> int external size: t -> int = "ml_z_size" [@@noalloc] (** Returns the number of machine words used to represent the number. *) -external extract: t -> int -> int -> t = "ml_z_extract" -(** [extract a off len] returns a nonnegative number corresponding to bits - [off] to [off]+[len]-1 of [b]. - Negative [a] are considered in infinite-length 2's complement - representation. - *) - -val signed_extract: t -> int -> int -> t -(** [signed_extract a off len] extracts bits [off] to [off]+[len]-1 of [b], - as [extract] does, then sign-extends bit [len-1] of the result - (that is, bit [off + len - 1] of [a]). The result is between - [- 2{^[len]-1}] (included) and [2{^[len]-1}] (excluded), - and equal to [extract a off len] modulo [2{^len}]. - *) - external to_bits: t -> string = "ml_z_to_bits" (** Returns a binary representation of the argument. The string result should be interpreted as a sequence of bytes, diff --git a/src/lib_protocol_environment/sigs/v3.ml b/src/lib_protocol_environment/sigs/v3.ml index 564064b803b4..e2f74b3f37fb 100644 --- a/src/lib_protocol_environment/sigs/v3.ml +++ b/src/lib_protocol_environment/sigs/v3.ml @@ -2699,21 +2699,6 @@ val log2up: t -> int external size: t -> int = "ml_z_size" [@@noalloc] (** Returns the number of machine words used to represent the number. *) -external extract: t -> int -> int -> t = "ml_z_extract" -(** [extract a off len] returns a nonnegative number corresponding to bits - [off] to [off]+[len]-1 of [b]. - Negative [a] are considered in infinite-length 2's complement - representation. - *) - -val signed_extract: t -> int -> int -> t -(** [signed_extract a off len] extracts bits [off] to [off]+[len]-1 of [b], - as [extract] does, then sign-extends bit [len-1] of the result - (that is, bit [off + len - 1] of [a]). The result is between - [- 2{^[len]-1}] (included) and [2{^[len]-1}] (excluded), - and equal to [extract a off len] modulo [2{^len}]. - *) - external to_bits: t -> string = "ml_z_to_bits" (** Returns a binary representation of the argument. The string result should be interpreted as a sequence of bytes, diff --git a/src/lib_protocol_environment/sigs/v3/z.mli b/src/lib_protocol_environment/sigs/v3/z.mli index b31519b72628..5361baec1fa4 100644 --- a/src/lib_protocol_environment/sigs/v3/z.mli +++ b/src/lib_protocol_environment/sigs/v3/z.mli @@ -435,21 +435,6 @@ val log2up: t -> int external size: t -> int = "ml_z_size" [@@noalloc] (** Returns the number of machine words used to represent the number. *) -external extract: t -> int -> int -> t = "ml_z_extract" -(** [extract a off len] returns a nonnegative number corresponding to bits - [off] to [off]+[len]-1 of [b]. - Negative [a] are considered in infinite-length 2's complement - representation. - *) - -val signed_extract: t -> int -> int -> t -(** [signed_extract a off len] extracts bits [off] to [off]+[len]-1 of [b], - as [extract] does, then sign-extends bit [len-1] of the result - (that is, bit [off + len - 1] of [a]). The result is between - [- 2{^[len]-1}] (included) and [2{^[len]-1}] (excluded), - and equal to [extract a off len] modulo [2{^len}]. - *) - external to_bits: t -> string = "ml_z_to_bits" (** Returns a binary representation of the argument. The string result should be interpreted as a sequence of bytes, diff --git a/src/lib_protocol_environment/sigs/v4.ml b/src/lib_protocol_environment/sigs/v4.ml index 4f2e468ab803..af1c48796f56 100644 --- a/src/lib_protocol_environment/sigs/v4.ml +++ b/src/lib_protocol_environment/sigs/v4.ml @@ -2708,21 +2708,6 @@ val log2up: t -> int external size: t -> int = "ml_z_size" [@@noalloc] (** Returns the number of machine words used to represent the number. *) -external extract: t -> int -> int -> t = "ml_z_extract" -(** [extract a off len] returns a nonnegative number corresponding to bits - [off] to [off]+[len]-1 of [b]. - Negative [a] are considered in infinite-length 2's complement - representation. - *) - -val signed_extract: t -> int -> int -> t -(** [signed_extract a off len] extracts bits [off] to [off]+[len]-1 of [b], - as [extract] does, then sign-extends bit [len-1] of the result - (that is, bit [off + len - 1] of [a]). The result is between - [- 2{^[len]-1}] (included) and [2{^[len]-1}] (excluded), - and equal to [extract a off len] modulo [2{^len}]. - *) - external to_bits: t -> string = "ml_z_to_bits" (** Returns a binary representation of the argument. The string result should be interpreted as a sequence of bytes, diff --git a/src/lib_protocol_environment/sigs/v4/z.mli b/src/lib_protocol_environment/sigs/v4/z.mli index e04b459a7f0e..201fa62236ed 100644 --- a/src/lib_protocol_environment/sigs/v4/z.mli +++ b/src/lib_protocol_environment/sigs/v4/z.mli @@ -435,21 +435,6 @@ val log2up: t -> int external size: t -> int = "ml_z_size" [@@noalloc] (** Returns the number of machine words used to represent the number. *) -external extract: t -> int -> int -> t = "ml_z_extract" -(** [extract a off len] returns a nonnegative number corresponding to bits - [off] to [off]+[len]-1 of [b]. - Negative [a] are considered in infinite-length 2's complement - representation. - *) - -val signed_extract: t -> int -> int -> t -(** [signed_extract a off len] extracts bits [off] to [off]+[len]-1 of [b], - as [extract] does, then sign-extends bit [len-1] of the result - (that is, bit [off + len - 1] of [a]). The result is between - [- 2{^[len]-1}] (included) and [2{^[len]-1}] (excluded), - and equal to [extract a off len] modulo [2{^len}]. - *) - external to_bits: t -> string = "ml_z_to_bits" (** Returns a binary representation of the argument. The string result should be interpreted as a sequence of bytes, diff --git a/src/lib_protocol_environment/sigs/v5.ml b/src/lib_protocol_environment/sigs/v5.ml index d43a15ccc721..36f057c0322b 100644 --- a/src/lib_protocol_environment/sigs/v5.ml +++ b/src/lib_protocol_environment/sigs/v5.ml @@ -2799,21 +2799,6 @@ val log2up: t -> int external size: t -> int = "ml_z_size" [@@noalloc] (** Returns the number of machine words used to represent the number. *) -external extract: t -> int -> int -> t = "ml_z_extract" -(** [extract a off len] returns a nonnegative number corresponding to bits - [off] to [off]+[len]-1 of [b]. - Negative [a] are considered in infinite-length 2's complement - representation. - *) - -val signed_extract: t -> int -> int -> t -(** [signed_extract a off len] extracts bits [off] to [off]+[len]-1 of [b], - as [extract] does, then sign-extends bit [len-1] of the result - (that is, bit [off + len - 1] of [a]). The result is between - [- 2{^[len]-1}] (included) and [2{^[len]-1}] (excluded), - and equal to [extract a off len] modulo [2{^len}]. - *) - external to_bits: t -> string = "ml_z_to_bits" (** Returns a binary representation of the argument. The string result should be interpreted as a sequence of bytes, diff --git a/src/lib_protocol_environment/sigs/v5/z.mli b/src/lib_protocol_environment/sigs/v5/z.mli index e04b459a7f0e..201fa62236ed 100644 --- a/src/lib_protocol_environment/sigs/v5/z.mli +++ b/src/lib_protocol_environment/sigs/v5/z.mli @@ -435,21 +435,6 @@ val log2up: t -> int external size: t -> int = "ml_z_size" [@@noalloc] (** Returns the number of machine words used to represent the number. *) -external extract: t -> int -> int -> t = "ml_z_extract" -(** [extract a off len] returns a nonnegative number corresponding to bits - [off] to [off]+[len]-1 of [b]. - Negative [a] are considered in infinite-length 2's complement - representation. - *) - -val signed_extract: t -> int -> int -> t -(** [signed_extract a off len] extracts bits [off] to [off]+[len]-1 of [b], - as [extract] does, then sign-extends bit [len-1] of the result - (that is, bit [off + len - 1] of [a]). The result is between - [- 2{^[len]-1}] (included) and [2{^[len]-1}] (excluded), - and equal to [extract a off len] modulo [2{^len}]. - *) - external to_bits: t -> string = "ml_z_to_bits" (** Returns a binary representation of the argument. The string result should be interpreted as a sequence of bytes, diff --git a/src/lib_protocol_environment/sigs/v6.ml b/src/lib_protocol_environment/sigs/v6.ml index 2056296fd2e0..9e31c63aa946 100644 --- a/src/lib_protocol_environment/sigs/v6.ml +++ b/src/lib_protocol_environment/sigs/v6.ml @@ -2799,21 +2799,6 @@ val log2up: t -> int external size: t -> int = "ml_z_size" [@@noalloc] (** Returns the number of machine words used to represent the number. *) -external extract: t -> int -> int -> t = "ml_z_extract" -(** [extract a off len] returns a nonnegative number corresponding to bits - [off] to [off]+[len]-1 of [b]. - Negative [a] are considered in infinite-length 2's complement - representation. - *) - -val signed_extract: t -> int -> int -> t -(** [signed_extract a off len] extracts bits [off] to [off]+[len]-1 of [b], - as [extract] does, then sign-extends bit [len-1] of the result - (that is, bit [off + len - 1] of [a]). The result is between - [- 2{^[len]-1}] (included) and [2{^[len]-1}] (excluded), - and equal to [extract a off len] modulo [2{^len}]. - *) - external to_bits: t -> string = "ml_z_to_bits" (** Returns a binary representation of the argument. The string result should be interpreted as a sequence of bytes, diff --git a/src/lib_protocol_environment/sigs/v6/z.mli b/src/lib_protocol_environment/sigs/v6/z.mli index e04b459a7f0e..201fa62236ed 100644 --- a/src/lib_protocol_environment/sigs/v6/z.mli +++ b/src/lib_protocol_environment/sigs/v6/z.mli @@ -435,21 +435,6 @@ val log2up: t -> int external size: t -> int = "ml_z_size" [@@noalloc] (** Returns the number of machine words used to represent the number. *) -external extract: t -> int -> int -> t = "ml_z_extract" -(** [extract a off len] returns a nonnegative number corresponding to bits - [off] to [off]+[len]-1 of [b]. - Negative [a] are considered in infinite-length 2's complement - representation. - *) - -val signed_extract: t -> int -> int -> t -(** [signed_extract a off len] extracts bits [off] to [off]+[len]-1 of [b], - as [extract] does, then sign-extends bit [len-1] of the result - (that is, bit [off + len - 1] of [a]). The result is between - [- 2{^[len]-1}] (included) and [2{^[len]-1}] (excluded), - and equal to [extract a off len] modulo [2{^len}]. - *) - external to_bits: t -> string = "ml_z_to_bits" (** Returns a binary representation of the argument. The string result should be interpreted as a sequence of bytes, diff --git a/src/lib_protocol_environment/sigs/v7.ml b/src/lib_protocol_environment/sigs/v7.ml index db54ebbef4e4..8324fd1d44eb 100644 --- a/src/lib_protocol_environment/sigs/v7.ml +++ b/src/lib_protocol_environment/sigs/v7.ml @@ -2799,21 +2799,6 @@ val log2up: t -> int external size: t -> int = "ml_z_size" [@@noalloc] (** Returns the number of machine words used to represent the number. *) -external extract: t -> int -> int -> t = "ml_z_extract" -(** [extract a off len] returns a nonnegative number corresponding to bits - [off] to [off]+[len]-1 of [b]. - Negative [a] are considered in infinite-length 2's complement - representation. - *) - -val signed_extract: t -> int -> int -> t -(** [signed_extract a off len] extracts bits [off] to [off]+[len]-1 of [b], - as [extract] does, then sign-extends bit [len-1] of the result - (that is, bit [off + len - 1] of [a]). The result is between - [- 2{^[len]-1}] (included) and [2{^[len]-1}] (excluded), - and equal to [extract a off len] modulo [2{^len}]. - *) - external to_bits: t -> string = "ml_z_to_bits" (** Returns a binary representation of the argument. The string result should be interpreted as a sequence of bytes, diff --git a/src/lib_protocol_environment/sigs/v7/z.mli b/src/lib_protocol_environment/sigs/v7/z.mli index bc93f0cdcd0a..adbc20dbe812 100644 --- a/src/lib_protocol_environment/sigs/v7/z.mli +++ b/src/lib_protocol_environment/sigs/v7/z.mli @@ -435,21 +435,6 @@ val log2up: t -> int external size: t -> int = "ml_z_size" [@@noalloc] (** Returns the number of machine words used to represent the number. *) -external extract: t -> int -> int -> t = "ml_z_extract" -(** [extract a off len] returns a nonnegative number corresponding to bits - [off] to [off]+[len]-1 of [b]. - Negative [a] are considered in infinite-length 2's complement - representation. - *) - -val signed_extract: t -> int -> int -> t -(** [signed_extract a off len] extracts bits [off] to [off]+[len]-1 of [b], - as [extract] does, then sign-extends bit [len-1] of the result - (that is, bit [off + len - 1] of [a]). The result is between - [- 2{^[len]-1}] (included) and [2{^[len]-1}] (excluded), - and equal to [extract a off len] modulo [2{^len}]. - *) - external to_bits: t -> string = "ml_z_to_bits" (** Returns a binary representation of the argument. The string result should be interpreted as a sequence of bytes, diff --git a/src/lib_protocol_environment/sigs/v8.ml b/src/lib_protocol_environment/sigs/v8.ml index e10325fec779..2a4bc4088fe0 100644 --- a/src/lib_protocol_environment/sigs/v8.ml +++ b/src/lib_protocol_environment/sigs/v8.ml @@ -2857,21 +2857,6 @@ val log2up: t -> int external size: t -> int = "ml_z_size" [@@noalloc] (** Returns the number of machine words used to represent the number. *) -external extract: t -> int -> int -> t = "ml_z_extract" -(** [extract a off len] returns a nonnegative number corresponding to bits - [off] to [off]+[len]-1 of [b]. - Negative [a] are considered in infinite-length 2's complement - representation. - *) - -val signed_extract: t -> int -> int -> t -(** [signed_extract a off len] extracts bits [off] to [off]+[len]-1 of [b], - as [extract] does, then sign-extends bit [len-1] of the result - (that is, bit [off + len - 1] of [a]). The result is between - [- 2{^[len]-1}] (included) and [2{^[len]-1}] (excluded), - and equal to [extract a off len] modulo [2{^len}]. - *) - external to_bits: t -> string = "ml_z_to_bits" (** Returns a binary representation of the argument. The string result should be interpreted as a sequence of bytes, diff --git a/src/lib_protocol_environment/sigs/v8/z.mli b/src/lib_protocol_environment/sigs/v8/z.mli index bc93f0cdcd0a..adbc20dbe812 100644 --- a/src/lib_protocol_environment/sigs/v8/z.mli +++ b/src/lib_protocol_environment/sigs/v8/z.mli @@ -435,21 +435,6 @@ val log2up: t -> int external size: t -> int = "ml_z_size" [@@noalloc] (** Returns the number of machine words used to represent the number. *) -external extract: t -> int -> int -> t = "ml_z_extract" -(** [extract a off len] returns a nonnegative number corresponding to bits - [off] to [off]+[len]-1 of [b]. - Negative [a] are considered in infinite-length 2's complement - representation. - *) - -val signed_extract: t -> int -> int -> t -(** [signed_extract a off len] extracts bits [off] to [off]+[len]-1 of [b], - as [extract] does, then sign-extends bit [len-1] of the result - (that is, bit [off + len - 1] of [a]). The result is between - [- 2{^[len]-1}] (included) and [2{^[len]-1}] (excluded), - and equal to [extract a off len] modulo [2{^len}]. - *) - external to_bits: t -> string = "ml_z_to_bits" (** Returns a binary representation of the argument. The string result should be interpreted as a sequence of bytes, diff --git a/src/lib_protocol_environment/sigs/v9.ml b/src/lib_protocol_environment/sigs/v9.ml index 92d867725c6d..f4b0af547843 100644 --- a/src/lib_protocol_environment/sigs/v9.ml +++ b/src/lib_protocol_environment/sigs/v9.ml @@ -2857,21 +2857,6 @@ val log2up: t -> int external size: t -> int = "ml_z_size" [@@noalloc] (** Returns the number of machine words used to represent the number. *) -external extract: t -> int -> int -> t = "ml_z_extract" -(** [extract a off len] returns a nonnegative number corresponding to bits - [off] to [off]+[len]-1 of [b]. - Negative [a] are considered in infinite-length 2's complement - representation. - *) - -val signed_extract: t -> int -> int -> t -(** [signed_extract a off len] extracts bits [off] to [off]+[len]-1 of [b], - as [extract] does, then sign-extends bit [len-1] of the result - (that is, bit [off + len - 1] of [a]). The result is between - [- 2{^[len]-1}] (included) and [2{^[len]-1}] (excluded), - and equal to [extract a off len] modulo [2{^len}]. - *) - external to_bits: t -> string = "ml_z_to_bits" (** Returns a binary representation of the argument. The string result should be interpreted as a sequence of bytes, diff --git a/src/lib_protocol_environment/sigs/v9/z.mli b/src/lib_protocol_environment/sigs/v9/z.mli index bc93f0cdcd0a..adbc20dbe812 100644 --- a/src/lib_protocol_environment/sigs/v9/z.mli +++ b/src/lib_protocol_environment/sigs/v9/z.mli @@ -435,21 +435,6 @@ val log2up: t -> int external size: t -> int = "ml_z_size" [@@noalloc] (** Returns the number of machine words used to represent the number. *) -external extract: t -> int -> int -> t = "ml_z_extract" -(** [extract a off len] returns a nonnegative number corresponding to bits - [off] to [off]+[len]-1 of [b]. - Negative [a] are considered in infinite-length 2's complement - representation. - *) - -val signed_extract: t -> int -> int -> t -(** [signed_extract a off len] extracts bits [off] to [off]+[len]-1 of [b], - as [extract] does, then sign-extends bit [len-1] of the result - (that is, bit [off + len - 1] of [a]). The result is between - [- 2{^[len]-1}] (included) and [2{^[len]-1}] (excluded), - and equal to [extract a off len] modulo [2{^len}]. - *) - external to_bits: t -> string = "ml_z_to_bits" (** Returns a binary representation of the argument. The string result should be interpreted as a sequence of bytes, -- GitLab From a2fe9152f1e922da562764e4d29f02a41328476f Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Wed, 18 Oct 2023 17:29:19 +0200 Subject: [PATCH 3/6] proto-env: sync doc z in v11 --- src/lib_protocol_environment/sigs/v11.ml | 55 ++++++++++++++------- src/lib_protocol_environment/sigs/v11/z.mli | 55 ++++++++++++++------- 2 files changed, 76 insertions(+), 34 deletions(-) diff --git a/src/lib_protocol_environment/sigs/v11.ml b/src/lib_protocol_environment/sigs/v11.ml index ae6b446a897a..76285713d1fe 100644 --- a/src/lib_protocol_environment/sigs/v11.ml +++ b/src/lib_protocol_environment/sigs/v11.ml @@ -2491,10 +2491,10 @@ external of_int: int -> t = "%identity" (** Converts from a base integer. *) external of_int32: int32 -> t = "ml_z_of_int32" -(** Converts from a 32-bit integer. *) +(** Converts from a 32-bit (signed) integer. *) external of_int64: int64 -> t = "ml_z_of_int64" -(** Converts from a 64-bit integer. *) +(** Converts from a 64-bit (signed) integer. *) val of_string: string -> t (** Converts a string to an integer. @@ -2512,7 +2512,8 @@ val of_string: string -> t val of_substring : string -> pos:int -> len:int -> t (** [of_substring s ~pos ~len] is the same as [of_string (String.sub s pos len)] - *) + @since 1.4 +*) val of_string_base: int -> string -> t (** Parses a number represented as a string in the specified base, @@ -2525,6 +2526,7 @@ external of_substring_base = "ml_z_of_substring_base" (** [of_substring_base base s ~pos ~len] is the same as [of_string_base base (String.sub s pos len)] + @since 1.4 *) @@ -2609,12 +2611,14 @@ external divisible: t -> t -> bool = "ml_z_divisible" (** [divisible a b] returns [true] if [a] is exactly divisible by [b]. Unlike the other division functions, [b = 0] is accepted (only 0 is considered divisible by 0). + @since 1.10 *) external congruent: t -> t -> t -> bool = "ml_z_congruent" (** [congruent a b c] returns [true] if [a] is congruent to [b] modulo [c]. Unlike the other division functions, [c = 0] is accepted (only equal numbers are considered equal congruent 0). + @since 1.10 *) @@ -2665,7 +2669,9 @@ external numbits: t -> int = "ml_z_numbits" [@@noalloc] If [x] is zero, [numbits x] returns 0. Otherwise, [numbits x] returns a positive integer [n] such that [2^{n-1} <= |x| < 2^n]. Note that [numbits] is defined - for negative arguments, and that [numbits (-x) = numbits x]. *) + for negative arguments, and that [numbits (-x) = numbits x]. + @since 1.4 +*) external trailing_zeros: t -> int = "ml_z_trailing_zeros" [@@noalloc] (** Returns the number of trailing 0 bits in the given number. @@ -2673,13 +2679,17 @@ external trailing_zeros: t -> int = "ml_z_trailing_zeros" [@@noalloc] Otherwise, [trailing_zeros x] returns a nonnegative integer [n] which is the largest [n] such that [2^n] divides [x] evenly. Note that [trailing_zeros] is defined for negative arguments, - and that [trailing_zeros (-x) = trailing_zeros x]. *) + and that [trailing_zeros (-x) = trailing_zeros x]. + @since 1.4 +*) val testbit: t -> int -> bool (** [testbit x n] return the value of bit number [n] in [x]: [true] if the bit is 1, [false] if the bit is 0. Bits are numbered from 0. Raise [Invalid_argument] if [n] - is negative. *) + is negative. + @since 1.4 +*) external popcount: t -> int = "ml_z_popcount" (** Counts the number of bits set. @@ -2700,13 +2710,16 @@ external hamdist: t -> t -> int = "ml_z_hamdist" *) val to_int: t -> int -(** Converts to a base integer. May raise an [Overflow]. *) +(** Converts to a signed OCaml [int]. + Raises an [Overflow] if the value does not fit in a signed OCaml [int]. *) external to_int32: t -> int32 = "ml_z_to_int32" -(** Converts to a 32-bit integer. May raise [Overflow]. *) +(** Converts to a signed 32-bit integer [int32]. + Raises an [Overflow] if the value does not fit in a signed [int32]. *) external to_int64: t -> int64 = "ml_z_to_int64" -(** Converts to a 64-bit integer. May raise [Overflow]. *) +(** Converts to a signed 64-bit integer [int64]. + Raises an [Overflow] if the value does not fit in a signed [int64]. *) val to_string: t -> string (** Gives a human-readable, decimal string representation of the argument. *) @@ -2740,13 +2753,13 @@ external format: string -> t -> string = "ml_z_format" *) external fits_int: t -> bool = "ml_z_fits_int" [@@noalloc] -(** Whether the argument fits in a regular [int]. *) +(** Whether the argument fits in an OCaml signed [int]. *) external fits_int32: t -> bool = "ml_z_fits_int32" [@@noalloc] -(** Whether the argument fits in an [int32]. *) +(** Whether the argument fits in a signed [int32]. *) external fits_int64: t -> bool = "ml_z_fits_int64" [@@noalloc] -(** Whether the argument fits in an [int64]. *) +(** Whether the argument fits in a signed [int64]. *) (** {1 Printing} *) @@ -2795,10 +2808,14 @@ val max: t -> t -> t (** Returns the maximum of its arguments. *) val is_even: t -> bool -(** Returns true if the argument is even (divisible by 2), false if odd. *) +(** Returns true if the argument is even (divisible by 2), false if odd. + @since 1.4 +*) val is_odd: t -> bool -(** Returns true if the argument is odd, false if even. *) +(** Returns true if the argument is odd, false if even. + @since 1.4 +*) (** {1 Powers} *) @@ -2832,7 +2849,7 @@ external rootrem: t -> int -> t * t = "ml_z_rootrem" [x-root**n]. [n] must be positive and, if [n] is even, then [x] must be nonnegative. Otherwise, an [Invalid_argument] is raised. - *) + @since 1.10 *) external perfect_power: t -> bool = "ml_z_perfect_power" (** True if the argument has the form [a^b], with [b>1] *) @@ -2844,13 +2861,17 @@ val log2: t -> int (** Returns the base-2 logarithm of its argument, rounded down to an integer. If [x] is positive, [log2 x] returns the largest [n] such that [2^n <= x]. If [x] is negative or zero, [log2 x] raise - the [Invalid_argument] exception. *) + the [Invalid_argument] exception. + @since 1.4 +*) val log2up: t -> int (** Returns the base-2 logarithm of its argument, rounded up to an integer. If [x] is positive, [log2up x] returns the smallest [n] such that [x <= 2^n]. If [x] is negative or zero, [log2up x] raise - the [Invalid_argument] exception. *) + the [Invalid_argument] exception. + @since 1.4 +*) (** {1 Representation} *) diff --git a/src/lib_protocol_environment/sigs/v11/z.mli b/src/lib_protocol_environment/sigs/v11/z.mli index 9653bf7c0097..d05230601af0 100644 --- a/src/lib_protocol_environment/sigs/v11/z.mli +++ b/src/lib_protocol_environment/sigs/v11/z.mli @@ -69,10 +69,10 @@ external of_int: int -> t = "%identity" (** Converts from a base integer. *) external of_int32: int32 -> t = "ml_z_of_int32" -(** Converts from a 32-bit integer. *) +(** Converts from a 32-bit (signed) integer. *) external of_int64: int64 -> t = "ml_z_of_int64" -(** Converts from a 64-bit integer. *) +(** Converts from a 64-bit (signed) integer. *) val of_string: string -> t (** Converts a string to an integer. @@ -90,7 +90,8 @@ val of_string: string -> t val of_substring : string -> pos:int -> len:int -> t (** [of_substring s ~pos ~len] is the same as [of_string (String.sub s pos len)] - *) + @since 1.4 +*) val of_string_base: int -> string -> t (** Parses a number represented as a string in the specified base, @@ -103,6 +104,7 @@ external of_substring_base = "ml_z_of_substring_base" (** [of_substring_base base s ~pos ~len] is the same as [of_string_base base (String.sub s pos len)] + @since 1.4 *) @@ -187,12 +189,14 @@ external divisible: t -> t -> bool = "ml_z_divisible" (** [divisible a b] returns [true] if [a] is exactly divisible by [b]. Unlike the other division functions, [b = 0] is accepted (only 0 is considered divisible by 0). + @since 1.10 *) external congruent: t -> t -> t -> bool = "ml_z_congruent" (** [congruent a b c] returns [true] if [a] is congruent to [b] modulo [c]. Unlike the other division functions, [c = 0] is accepted (only equal numbers are considered equal congruent 0). + @since 1.10 *) @@ -243,7 +247,9 @@ external numbits: t -> int = "ml_z_numbits" [@@noalloc] If [x] is zero, [numbits x] returns 0. Otherwise, [numbits x] returns a positive integer [n] such that [2^{n-1} <= |x| < 2^n]. Note that [numbits] is defined - for negative arguments, and that [numbits (-x) = numbits x]. *) + for negative arguments, and that [numbits (-x) = numbits x]. + @since 1.4 +*) external trailing_zeros: t -> int = "ml_z_trailing_zeros" [@@noalloc] (** Returns the number of trailing 0 bits in the given number. @@ -251,13 +257,17 @@ external trailing_zeros: t -> int = "ml_z_trailing_zeros" [@@noalloc] Otherwise, [trailing_zeros x] returns a nonnegative integer [n] which is the largest [n] such that [2^n] divides [x] evenly. Note that [trailing_zeros] is defined for negative arguments, - and that [trailing_zeros (-x) = trailing_zeros x]. *) + and that [trailing_zeros (-x) = trailing_zeros x]. + @since 1.4 +*) val testbit: t -> int -> bool (** [testbit x n] return the value of bit number [n] in [x]: [true] if the bit is 1, [false] if the bit is 0. Bits are numbered from 0. Raise [Invalid_argument] if [n] - is negative. *) + is negative. + @since 1.4 +*) external popcount: t -> int = "ml_z_popcount" (** Counts the number of bits set. @@ -278,13 +288,16 @@ external hamdist: t -> t -> int = "ml_z_hamdist" *) val to_int: t -> int -(** Converts to a base integer. May raise an [Overflow]. *) +(** Converts to a signed OCaml [int]. + Raises an [Overflow] if the value does not fit in a signed OCaml [int]. *) external to_int32: t -> int32 = "ml_z_to_int32" -(** Converts to a 32-bit integer. May raise [Overflow]. *) +(** Converts to a signed 32-bit integer [int32]. + Raises an [Overflow] if the value does not fit in a signed [int32]. *) external to_int64: t -> int64 = "ml_z_to_int64" -(** Converts to a 64-bit integer. May raise [Overflow]. *) +(** Converts to a signed 64-bit integer [int64]. + Raises an [Overflow] if the value does not fit in a signed [int64]. *) val to_string: t -> string (** Gives a human-readable, decimal string representation of the argument. *) @@ -318,13 +331,13 @@ external format: string -> t -> string = "ml_z_format" *) external fits_int: t -> bool = "ml_z_fits_int" [@@noalloc] -(** Whether the argument fits in a regular [int]. *) +(** Whether the argument fits in an OCaml signed [int]. *) external fits_int32: t -> bool = "ml_z_fits_int32" [@@noalloc] -(** Whether the argument fits in an [int32]. *) +(** Whether the argument fits in a signed [int32]. *) external fits_int64: t -> bool = "ml_z_fits_int64" [@@noalloc] -(** Whether the argument fits in an [int64]. *) +(** Whether the argument fits in a signed [int64]. *) (** {1 Printing} *) @@ -373,10 +386,14 @@ val max: t -> t -> t (** Returns the maximum of its arguments. *) val is_even: t -> bool -(** Returns true if the argument is even (divisible by 2), false if odd. *) +(** Returns true if the argument is even (divisible by 2), false if odd. + @since 1.4 +*) val is_odd: t -> bool -(** Returns true if the argument is odd, false if even. *) +(** Returns true if the argument is odd, false if even. + @since 1.4 +*) (** {1 Powers} *) @@ -410,7 +427,7 @@ external rootrem: t -> int -> t * t = "ml_z_rootrem" [x-root**n]. [n] must be positive and, if [n] is even, then [x] must be nonnegative. Otherwise, an [Invalid_argument] is raised. - *) + @since 1.10 *) external perfect_power: t -> bool = "ml_z_perfect_power" (** True if the argument has the form [a^b], with [b>1] *) @@ -422,13 +439,17 @@ val log2: t -> int (** Returns the base-2 logarithm of its argument, rounded down to an integer. If [x] is positive, [log2 x] returns the largest [n] such that [2^n <= x]. If [x] is negative or zero, [log2 x] raise - the [Invalid_argument] exception. *) + the [Invalid_argument] exception. + @since 1.4 +*) val log2up: t -> int (** Returns the base-2 logarithm of its argument, rounded up to an integer. If [x] is positive, [log2up x] returns the smallest [n] such that [x <= 2^n]. If [x] is negative or zero, [log2up x] raise - the [Invalid_argument] exception. *) + the [Invalid_argument] exception. + @since 1.4 +*) (** {1 Representation} *) -- GitLab From 70ec421ea19c0a752d889ba3a598f1cf0e180da1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Proust?= Date: Thu, 18 Jan 2024 17:24:08 +0100 Subject: [PATCH 4/6] proto-env: sync doc z in v12 --- src/lib_protocol_environment/sigs/v12.ml | 55 ++++++++++++++------- src/lib_protocol_environment/sigs/v12/z.mli | 55 ++++++++++++++------- 2 files changed, 76 insertions(+), 34 deletions(-) diff --git a/src/lib_protocol_environment/sigs/v12.ml b/src/lib_protocol_environment/sigs/v12.ml index f26b8cb133f5..6fde91b06a38 100644 --- a/src/lib_protocol_environment/sigs/v12.ml +++ b/src/lib_protocol_environment/sigs/v12.ml @@ -2491,10 +2491,10 @@ external of_int: int -> t = "%identity" (** Converts from a base integer. *) external of_int32: int32 -> t = "ml_z_of_int32" -(** Converts from a 32-bit integer. *) +(** Converts from a 32-bit (signed) integer. *) external of_int64: int64 -> t = "ml_z_of_int64" -(** Converts from a 64-bit integer. *) +(** Converts from a 64-bit (signed) integer. *) val of_string: string -> t (** Converts a string to an integer. @@ -2512,7 +2512,8 @@ val of_string: string -> t val of_substring : string -> pos:int -> len:int -> t (** [of_substring s ~pos ~len] is the same as [of_string (String.sub s pos len)] - *) + @since 1.4 +*) val of_string_base: int -> string -> t (** Parses a number represented as a string in the specified base, @@ -2525,6 +2526,7 @@ external of_substring_base = "ml_z_of_substring_base" (** [of_substring_base base s ~pos ~len] is the same as [of_string_base base (String.sub s pos len)] + @since 1.4 *) @@ -2609,12 +2611,14 @@ external divisible: t -> t -> bool = "ml_z_divisible" (** [divisible a b] returns [true] if [a] is exactly divisible by [b]. Unlike the other division functions, [b = 0] is accepted (only 0 is considered divisible by 0). + @since 1.10 *) external congruent: t -> t -> t -> bool = "ml_z_congruent" (** [congruent a b c] returns [true] if [a] is congruent to [b] modulo [c]. Unlike the other division functions, [c = 0] is accepted (only equal numbers are considered equal congruent 0). + @since 1.10 *) @@ -2665,7 +2669,9 @@ external numbits: t -> int = "ml_z_numbits" [@@noalloc] If [x] is zero, [numbits x] returns 0. Otherwise, [numbits x] returns a positive integer [n] such that [2^{n-1} <= |x| < 2^n]. Note that [numbits] is defined - for negative arguments, and that [numbits (-x) = numbits x]. *) + for negative arguments, and that [numbits (-x) = numbits x]. + @since 1.4 +*) external trailing_zeros: t -> int = "ml_z_trailing_zeros" [@@noalloc] (** Returns the number of trailing 0 bits in the given number. @@ -2673,13 +2679,17 @@ external trailing_zeros: t -> int = "ml_z_trailing_zeros" [@@noalloc] Otherwise, [trailing_zeros x] returns a nonnegative integer [n] which is the largest [n] such that [2^n] divides [x] evenly. Note that [trailing_zeros] is defined for negative arguments, - and that [trailing_zeros (-x) = trailing_zeros x]. *) + and that [trailing_zeros (-x) = trailing_zeros x]. + @since 1.4 +*) val testbit: t -> int -> bool (** [testbit x n] return the value of bit number [n] in [x]: [true] if the bit is 1, [false] if the bit is 0. Bits are numbered from 0. Raise [Invalid_argument] if [n] - is negative. *) + is negative. + @since 1.4 +*) external popcount: t -> int = "ml_z_popcount" (** Counts the number of bits set. @@ -2700,13 +2710,16 @@ external hamdist: t -> t -> int = "ml_z_hamdist" *) val to_int: t -> int -(** Converts to a base integer. May raise an [Overflow]. *) +(** Converts to a signed OCaml [int]. + Raises an [Overflow] if the value does not fit in a signed OCaml [int]. *) external to_int32: t -> int32 = "ml_z_to_int32" -(** Converts to a 32-bit integer. May raise [Overflow]. *) +(** Converts to a signed 32-bit integer [int32]. + Raises an [Overflow] if the value does not fit in a signed [int32]. *) external to_int64: t -> int64 = "ml_z_to_int64" -(** Converts to a 64-bit integer. May raise [Overflow]. *) +(** Converts to a signed 64-bit integer [int64]. + Raises an [Overflow] if the value does not fit in a signed [int64]. *) val to_string: t -> string (** Gives a human-readable, decimal string representation of the argument. *) @@ -2740,13 +2753,13 @@ external format: string -> t -> string = "ml_z_format" *) external fits_int: t -> bool = "ml_z_fits_int" [@@noalloc] -(** Whether the argument fits in a regular [int]. *) +(** Whether the argument fits in an OCaml signed [int]. *) external fits_int32: t -> bool = "ml_z_fits_int32" [@@noalloc] -(** Whether the argument fits in an [int32]. *) +(** Whether the argument fits in a signed [int32]. *) external fits_int64: t -> bool = "ml_z_fits_int64" [@@noalloc] -(** Whether the argument fits in an [int64]. *) +(** Whether the argument fits in a signed [int64]. *) (** {1 Printing} *) @@ -2795,10 +2808,14 @@ val max: t -> t -> t (** Returns the maximum of its arguments. *) val is_even: t -> bool -(** Returns true if the argument is even (divisible by 2), false if odd. *) +(** Returns true if the argument is even (divisible by 2), false if odd. + @since 1.4 +*) val is_odd: t -> bool -(** Returns true if the argument is odd, false if even. *) +(** Returns true if the argument is odd, false if even. + @since 1.4 +*) (** {1 Powers} *) @@ -2832,7 +2849,7 @@ external rootrem: t -> int -> t * t = "ml_z_rootrem" [x-root**n]. [n] must be positive and, if [n] is even, then [x] must be nonnegative. Otherwise, an [Invalid_argument] is raised. - *) + @since 1.10 *) external perfect_power: t -> bool = "ml_z_perfect_power" (** True if the argument has the form [a^b], with [b>1] *) @@ -2844,13 +2861,17 @@ val log2: t -> int (** Returns the base-2 logarithm of its argument, rounded down to an integer. If [x] is positive, [log2 x] returns the largest [n] such that [2^n <= x]. If [x] is negative or zero, [log2 x] raise - the [Invalid_argument] exception. *) + the [Invalid_argument] exception. + @since 1.4 +*) val log2up: t -> int (** Returns the base-2 logarithm of its argument, rounded up to an integer. If [x] is positive, [log2up x] returns the smallest [n] such that [x <= 2^n]. If [x] is negative or zero, [log2up x] raise - the [Invalid_argument] exception. *) + the [Invalid_argument] exception. + @since 1.4 +*) (** {1 Representation} *) diff --git a/src/lib_protocol_environment/sigs/v12/z.mli b/src/lib_protocol_environment/sigs/v12/z.mli index 9653bf7c0097..d05230601af0 100644 --- a/src/lib_protocol_environment/sigs/v12/z.mli +++ b/src/lib_protocol_environment/sigs/v12/z.mli @@ -69,10 +69,10 @@ external of_int: int -> t = "%identity" (** Converts from a base integer. *) external of_int32: int32 -> t = "ml_z_of_int32" -(** Converts from a 32-bit integer. *) +(** Converts from a 32-bit (signed) integer. *) external of_int64: int64 -> t = "ml_z_of_int64" -(** Converts from a 64-bit integer. *) +(** Converts from a 64-bit (signed) integer. *) val of_string: string -> t (** Converts a string to an integer. @@ -90,7 +90,8 @@ val of_string: string -> t val of_substring : string -> pos:int -> len:int -> t (** [of_substring s ~pos ~len] is the same as [of_string (String.sub s pos len)] - *) + @since 1.4 +*) val of_string_base: int -> string -> t (** Parses a number represented as a string in the specified base, @@ -103,6 +104,7 @@ external of_substring_base = "ml_z_of_substring_base" (** [of_substring_base base s ~pos ~len] is the same as [of_string_base base (String.sub s pos len)] + @since 1.4 *) @@ -187,12 +189,14 @@ external divisible: t -> t -> bool = "ml_z_divisible" (** [divisible a b] returns [true] if [a] is exactly divisible by [b]. Unlike the other division functions, [b = 0] is accepted (only 0 is considered divisible by 0). + @since 1.10 *) external congruent: t -> t -> t -> bool = "ml_z_congruent" (** [congruent a b c] returns [true] if [a] is congruent to [b] modulo [c]. Unlike the other division functions, [c = 0] is accepted (only equal numbers are considered equal congruent 0). + @since 1.10 *) @@ -243,7 +247,9 @@ external numbits: t -> int = "ml_z_numbits" [@@noalloc] If [x] is zero, [numbits x] returns 0. Otherwise, [numbits x] returns a positive integer [n] such that [2^{n-1} <= |x| < 2^n]. Note that [numbits] is defined - for negative arguments, and that [numbits (-x) = numbits x]. *) + for negative arguments, and that [numbits (-x) = numbits x]. + @since 1.4 +*) external trailing_zeros: t -> int = "ml_z_trailing_zeros" [@@noalloc] (** Returns the number of trailing 0 bits in the given number. @@ -251,13 +257,17 @@ external trailing_zeros: t -> int = "ml_z_trailing_zeros" [@@noalloc] Otherwise, [trailing_zeros x] returns a nonnegative integer [n] which is the largest [n] such that [2^n] divides [x] evenly. Note that [trailing_zeros] is defined for negative arguments, - and that [trailing_zeros (-x) = trailing_zeros x]. *) + and that [trailing_zeros (-x) = trailing_zeros x]. + @since 1.4 +*) val testbit: t -> int -> bool (** [testbit x n] return the value of bit number [n] in [x]: [true] if the bit is 1, [false] if the bit is 0. Bits are numbered from 0. Raise [Invalid_argument] if [n] - is negative. *) + is negative. + @since 1.4 +*) external popcount: t -> int = "ml_z_popcount" (** Counts the number of bits set. @@ -278,13 +288,16 @@ external hamdist: t -> t -> int = "ml_z_hamdist" *) val to_int: t -> int -(** Converts to a base integer. May raise an [Overflow]. *) +(** Converts to a signed OCaml [int]. + Raises an [Overflow] if the value does not fit in a signed OCaml [int]. *) external to_int32: t -> int32 = "ml_z_to_int32" -(** Converts to a 32-bit integer. May raise [Overflow]. *) +(** Converts to a signed 32-bit integer [int32]. + Raises an [Overflow] if the value does not fit in a signed [int32]. *) external to_int64: t -> int64 = "ml_z_to_int64" -(** Converts to a 64-bit integer. May raise [Overflow]. *) +(** Converts to a signed 64-bit integer [int64]. + Raises an [Overflow] if the value does not fit in a signed [int64]. *) val to_string: t -> string (** Gives a human-readable, decimal string representation of the argument. *) @@ -318,13 +331,13 @@ external format: string -> t -> string = "ml_z_format" *) external fits_int: t -> bool = "ml_z_fits_int" [@@noalloc] -(** Whether the argument fits in a regular [int]. *) +(** Whether the argument fits in an OCaml signed [int]. *) external fits_int32: t -> bool = "ml_z_fits_int32" [@@noalloc] -(** Whether the argument fits in an [int32]. *) +(** Whether the argument fits in a signed [int32]. *) external fits_int64: t -> bool = "ml_z_fits_int64" [@@noalloc] -(** Whether the argument fits in an [int64]. *) +(** Whether the argument fits in a signed [int64]. *) (** {1 Printing} *) @@ -373,10 +386,14 @@ val max: t -> t -> t (** Returns the maximum of its arguments. *) val is_even: t -> bool -(** Returns true if the argument is even (divisible by 2), false if odd. *) +(** Returns true if the argument is even (divisible by 2), false if odd. + @since 1.4 +*) val is_odd: t -> bool -(** Returns true if the argument is odd, false if even. *) +(** Returns true if the argument is odd, false if even. + @since 1.4 +*) (** {1 Powers} *) @@ -410,7 +427,7 @@ external rootrem: t -> int -> t * t = "ml_z_rootrem" [x-root**n]. [n] must be positive and, if [n] is even, then [x] must be nonnegative. Otherwise, an [Invalid_argument] is raised. - *) + @since 1.10 *) external perfect_power: t -> bool = "ml_z_perfect_power" (** True if the argument has the form [a^b], with [b>1] *) @@ -422,13 +439,17 @@ val log2: t -> int (** Returns the base-2 logarithm of its argument, rounded down to an integer. If [x] is positive, [log2 x] returns the largest [n] such that [2^n <= x]. If [x] is negative or zero, [log2 x] raise - the [Invalid_argument] exception. *) + the [Invalid_argument] exception. + @since 1.4 +*) val log2up: t -> int (** Returns the base-2 logarithm of its argument, rounded up to an integer. If [x] is positive, [log2up x] returns the smallest [n] such that [x <= 2^n]. If [x] is negative or zero, [log2up x] raise - the [Invalid_argument] exception. *) + the [Invalid_argument] exception. + @since 1.4 +*) (** {1 Representation} *) -- GitLab From c6bb31f862040aff3ff4688090ae50035f2084a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Proust?= Date: Thu, 18 Jan 2024 17:33:28 +0100 Subject: [PATCH 5/6] minimal req version for zarith stubs --- manifest/main.ml | 4 +++- opam/bls12-381.opam | 2 +- opam/octez-libs.opam | 2 +- opam/octez-proto-libs.opam | 2 +- opam/tezos-micheline-rewriting.opam | 2 +- opam/virtual/octez-deps.opam | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/manifest/main.ml b/manifest/main.ml index 49c9068b1c85..59c876508ad9 100644 --- a/manifest/main.ml +++ b/manifest/main.ml @@ -363,7 +363,9 @@ let zarith = "zarith" V.(at_least "1.13" && less_than "1.14") -let zarith_stubs_js = external_lib ~js_compatible:true "zarith_stubs_js" V.True +(* The 0.16.1 release matches of the stubs matches the 1.13 release of zarith *) +let zarith_stubs_js = + external_lib ~js_compatible:true "zarith_stubs_js" V.(at_least "0.16.1") let ledgerwallet_tezos = external_lib "ledgerwallet-tezos" V.(at_least "0.4.0") diff --git a/opam/bls12-381.opam b/opam/bls12-381.opam index a83297c88a2e..b9ba2a394679 100644 --- a/opam/bls12-381.opam +++ b/opam/bls12-381.opam @@ -13,7 +13,7 @@ depends: [ "integers" "integers_stubs_js" "zarith" { >= "1.13" & < "1.14" } - "zarith_stubs_js" + "zarith_stubs_js" { >= "0.16.1" } "hex" { >= "1.3.0" } "tezt" { with-test & >= "4.0.0" & < "5.0.0" } "octez-alcotezt" {with-test} diff --git a/opam/octez-libs.opam b/opam/octez-libs.opam index da44684529a1..07329097ce82 100644 --- a/opam/octez-libs.opam +++ b/opam/octez-libs.opam @@ -20,7 +20,7 @@ depends: [ "ppx_expect" "hex" { >= "1.3.0" } "zarith" { >= "1.13" & < "1.14" } - "zarith_stubs_js" + "zarith_stubs_js" { >= "0.16.1" } "aches" { >= "1.0.0" } "seqes" { >= "0.2" } "lwt-canceler" { >= "0.3" & < "0.4" } diff --git a/opam/octez-proto-libs.opam b/opam/octez-proto-libs.opam index 4fa844900825..51f9878ae3ee 100644 --- a/opam/octez-proto-libs.opam +++ b/opam/octez-proto-libs.opam @@ -15,7 +15,7 @@ depends: [ "data-encoding" { >= "0.7.1" & < "1.0.0" } "bls12-381" "zarith" { >= "1.13" & < "1.14" } - "zarith_stubs_js" + "zarith_stubs_js" { >= "0.16.1" } "class_group_vdf" { >= "0.0.4" } "aches" { >= "1.0.0" } "aches-lwt" { >= "1.0.0" } diff --git a/opam/tezos-micheline-rewriting.opam b/opam/tezos-micheline-rewriting.opam index de93934a0004..d0b421e2206a 100644 --- a/opam/tezos-micheline-rewriting.opam +++ b/opam/tezos-micheline-rewriting.opam @@ -11,7 +11,7 @@ depends: [ "dune" { >= "3.11.1" } "ocaml" { >= "4.14" } "zarith" { >= "1.13" & < "1.14" } - "zarith_stubs_js" + "zarith_stubs_js" { >= "0.16.1" } "octez-libs" "tezt" { with-test & >= "4.0.0" & < "5.0.0" } "tezos-protocol-alpha" {with-test} diff --git a/opam/virtual/octez-deps.opam b/opam/virtual/octez-deps.opam index 501667d327a9..b085e0de263a 100644 --- a/opam/virtual/octez-deps.opam +++ b/opam/virtual/octez-deps.opam @@ -108,7 +108,7 @@ depends: [ "uutf" "yaml" { >= "3.1.0" } "zarith" { >= "1.13" & < "1.14" } - "zarith_stubs_js" + "zarith_stubs_js" { >= "0.16.1" } ] conflicts: [ "checkseum" { = "0.5.0" } -- GitLab From 7a850572f57d1a6f7be3a1d4fccdc14a64c98afb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Proust?= Date: Thu, 15 Feb 2024 11:12:18 +0100 Subject: [PATCH 6/6] Fix commit hash of opam-repo --- .gitlab-ci.yml | 2 +- scripts/version.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 940a85263579..819758750f95 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -62,7 +62,7 @@ variables: # /!\ CI_REGISTRY is overriden to use a private Docker registry mirror in AWS ECR # in GitLab namespaces `nomadic-labs` and `tezos` ## This value MUST be the same as `opam_repository_tag` in `scripts/version.sh` - build_deps_image_version: b9a9313e3610545ac5c26e6f6d9cde9f63e32987 + build_deps_image_version: 216c0f260dd672aef71ac769d1435c4f2785db97 build_deps_image_name: "${CI_REGISTRY}/tezos/opam-repository" # This image is not automatically mirrored to AWS ECR and should be # fetch from the GitLab registry, so do not use CI_REGISTRY here. diff --git a/scripts/version.sh b/scripts/version.sh index 4e130e6145a9..770d6b27a8cf 100755 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -31,7 +31,7 @@ export full_opam_repository_tag=2314da5646931ec7f643bdc9aaa39177971ac857 ## opam_repository is an additional, tezos-specific opam repository. ## This value MUST be the same as `build_deps_image_version` in `.gitlab-ci.yml` export opam_repository_url=https://gitlab.com/tezos/opam-repository -export opam_repository_tag="${OPAM_REPOSITORY_TAG:-b9a9313e3610545ac5c26e6f6d9cde9f63e32987}" +export opam_repository_tag="${OPAM_REPOSITORY_TAG:-216c0f260dd672aef71ac769d1435c4f2785db97}" export opam_repository_git="$opam_repository_url.git" export opam_repository="$opam_repository_git"\#"$opam_repository_tag" -- GitLab