From ebdb24f96800a2e3de7540b4656ab281cfc78d22 Mon Sep 17 00:00:00 2001 From: kevaundray Date: Mon, 29 Jan 2024 16:44:25 +0000 Subject: [PATCH] chore(doc): Add docs for `assert_max_bit_size` (#4196) # Description Resolves https://github.com/noir-lang/noir/issues/4135 ## Problem\* Resolves ## Summary\* ## Additional Context ## Documentation\* Check one: - [ ] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[Exceptional Case]** Documentation to be submitted in a separate PR. # PR Checklist\* - [ ] I have tested the changes locally. - [ ] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings. 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.