From 22cab24a64302d4d109e80e9a701fc0f21f06ab1 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Mon, 29 Jan 2024 16:25:49 +0000 Subject: [PATCH] add docs for assert_max_bit_size Signed-off-by: Kevaundray Wedderburn --- docs/docs/noir/concepts/data_types/fields.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/docs/noir/concepts/data_types/fields.md b/docs/docs/noir/concepts/data_types/fields.md index a1c67945d66..7870c98c858 100644 --- a/docs/docs/noir/concepts/data_types/fields.md +++ b/docs/docs/noir/concepts/data_types/fields.md @@ -157,6 +157,23 @@ fn main() { } ``` +### assert_max_bit_size + +Adds a constraint to specify that the field can be represented with `bit_size` number of bits + +```rust +fn assert_max_bit_size(self, bit_size: u32) +``` + +example: + +```rust +fn main() { + let field = 2 + field.assert_max_bit_size(32); +} +``` + ### sgn0 Parity of (prime) Field element, i.e. sgn0(x mod p) = 0 if x ∈ \{0, ..., p-1\} is even, otherwise sgn0(x mod p) = 1.