You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,7 @@
10
10
- Reverted `InvokeKind::ProcRef` back to `InvokeKind::Exec` in `visit_mut_procref` and added an explanatory comment (#2893).
11
11
#### Changes
12
12
13
+
- Documented sortedness precondition more prominently for sorted array operations (#2832).
13
14
- Documented that enum variants are module-level constants and must be unique within a module (#2932).
14
15
-[BREAKING] Sync execution and proving APIs now require `SyncHost`; async `Host`, `execute`, and `prove` remain available ([#2865](https://github.com/0xMiden/miden-vm/pull/2865)).
15
16
-[BREAKING]`miden_processor::execute()` and `execute_sync()` now return `ExecutionOutput`; trace building remains explicit via `execute_trace_inputs*()` and `trace::build_trace()` ([#2865](https://github.com/0xMiden/miden-vm/pull/2865)).
#! This function will crash if the following conditions aren't met:
13
-
#! - words must be sorted in non-decreasing order,
14
-
#! - start_ptr, end_ptr are word-aligned
15
-
#! - `start_ptr <= end_ptr`
12
+
#! **The input array must be sorted in non-decreasing lexicographic order.** The host event handler validates this and will return an error if the array is not sorted.
#! Value doesn't exist and the array is empty: 25 cycles
@@ -146,20 +149,18 @@ end
146
149
147
150
#! Finds a key in a sorted array of (key, value) word tuples.
148
151
#!
152
+
#! **The keys in the array must be sorted in non-decreasing lexicographic order.** The host event handler validates this and will return an error if the keys are not sorted.
#! Half-key means that, out of the keys in the array, only half of the key - the most significant
177
178
#! element (prefix) and the second most significant element (suffix) - need to match.
178
179
#!
180
+
#! **The keys in the array must be sorted in non-decreasing lexicographic order.** The host event handler validates this and will return an error if the keys are not sorted.
#! - end_ptr is not double-word-aligned with the start_ptr:
188
190
#! - `(end_ptr - start_ptr)` must be divisible by 8
@@ -211,13 +213,14 @@ end
211
213
#! upon loading the key for comparison, its two least significant elements are zeroized.
212
214
#! This effectively means that only a match on the two most significant elements is required.
213
215
#!
216
+
#! **The keys in the array must be sorted in non-decreasing lexicographic order.** The host event handler validates this and will return an error if the keys are not sorted.
Copy file name to clipboardExpand all lines: crates/lib/core/docs/collections/sorted_array.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,6 @@
2
2
## miden::core::collections::sorted_array
3
3
| Procedure | Description |
4
4
| ----------- | ------------- |
5
-
| find_word | Finds a value in a sorted array of words.<br /><br />This function will crash if the following conditions aren't met:<br />- words must be sorted in non-decreasing order,<br />- start_ptr, end_ptr are word-aligned<br />- `start_ptr <= end_ptr`<br /><br />Input: [VALUE, start_ptr, end_ptr]<br />Output: [is_value_found, value_ptr, start_ptr, end_ptr]<br /><br />Cycles:<br />Value exists: 46 cycles<br />Value doesn't exist and the array is empty: 25 cycles<br />Value doesn't exist and is smaller than all elements: 151 cycles<br />Value doesn't exist and is larger than all elements: 149 cycles<br />Value doesn't exist: 286 cycles<br /> |
6
-
| find_key_value | Finds a key in a sorted array of (key, value) word tuples.<br /><br />Inputs: [KEY, start_ptr, end_ptr]<br />Outputs: [is_key_found, key_ptr, start_ptr, end_ptr]<br /><br /># Panics<br /><br />Panics if:<br />- keys are not sorted in non-decreasing order,<br />- start_ptr is not word-aligned<br />- end_ptr is not double-word-aligned with the start_ptr:<br />- `(end_ptr - start_ptr)` must be divisible by 8<br />- `start_ptr > end_ptr`<br /><br />Inputs: [KEY, start_ptr, end_ptr]<br />Output: [is_key_found, key_ptr, start_ptr, end_ptr]<br /> |
7
-
| find_half_key_value | Finds a half-key in a sorted array of (key, value) word tuples.<br /><br />Half-key means that, out of the keys in the array, only half of the key - the most significant<br />element (prefix) and the second most significant element (suffix) - need to match.<br /><br />Inputs: [key_suffix, key_prefix, start_ptr, end_ptr]<br />Output: [is_key_found, key_ptr, start_ptr, end_ptr]<br /><br /># Panics<br /><br />Panics if:<br />- keys are not sorted in non-decreasing order,<br />- start_ptr is not word-aligned<br />- end_ptr is not double-word-aligned with the start_ptr:<br />- `(end_ptr - start_ptr)` must be divisible by 8<br />- `start_ptr > end_ptr`<br /> |
5
+
| find_word | Finds a value in a sorted array of words.<br /><br />**The input array must be sorted in non-decreasing lexicographic order.** The host event handler validates this and will return an error if the array is not sorted.<br /><br />Input: [VALUE, start_ptr, end_ptr]<br />Output: [is_value_found, value_ptr, start_ptr, end_ptr]<br /><br /># Panics<br /><br />Panics if:<br />- start_ptr, end_ptr are not word-aligned<br />- `start_ptr > end_ptr`<br /><br />Cycles:<br />Value exists: 46 cycles<br />Value doesn't exist and the array is empty: 25 cycles<br />Value doesn't exist and is smaller than all elements: 151 cycles<br />Value doesn't exist and is larger than all elements: 149 cycles<br />Value doesn't exist: 286 cycles<br /> |
6
+
| find_key_value | Finds a key in a sorted array of (key, value) word tuples.<br /><br />**The keys in the array must be sorted in non-decreasing lexicographic order.** The host event handler validates this and will return an error if the keys are not sorted.<br /><br />Inputs: [KEY, start_ptr, end_ptr]<br />Outputs: [is_key_found, key_ptr, start_ptr, end_ptr]<br /><br /># Panics<br /><br />Panics if:<br />- start_ptr is not word-aligned<br />- end_ptr is not double-word-aligned with the start_ptr:<br />- `(end_ptr - start_ptr)` must be divisible by 8<br />- `start_ptr > end_ptr`<br /> |
7
+
| find_half_key_value | Finds a half-key in a sorted array of (key, value) word tuples.<br /><br />Half-key means that, out of the keys in the array, only half of the key - the most significant<br />element (prefix) and the second most significant element (suffix) - need to match.<br /><br />**The keys in the array must be sorted in non-decreasing lexicographic order.** The host event handler validates this and will return an error if the keys are not sorted.<br /><br />Inputs: [key_suffix, key_prefix, start_ptr, end_ptr]<br />Output: [is_key_found, key_ptr, start_ptr, end_ptr]<br /><br /># Panics<br /><br />Panics if:<br />- start_ptr is not word-aligned<br />- end_ptr is not double-word-aligned with the start_ptr:<br />- `(end_ptr - start_ptr)` must be divisible by 8<br />- `start_ptr > end_ptr`<br /> |
0 commit comments