Skip to content

Commit 4cd5300

Browse files
committed
use sort v0.3.0
1 parent 5f3a49e commit 4cd5300

3 files changed

Lines changed: 16 additions & 16 deletions

File tree

Nargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ authors = [""]
55
compiler_version = ">=0.36.0"
66

77
[dependencies]
8-
sort = { tag = "v0.2.3", git = "https://github.com/noir-lang/noir_sort" }
8+
sort = { tag = "v0.3.0", git = "https://github.com/noir-lang/noir_sort" }

src/lib.nr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ where
151151
// case 2 can be modified to `self.keys[found_index] + 1 <= idx <= self.keys[found_index + 1] - 1
152152
// combine the two into the following single statement:
153153
// `self.keys[found_index] + 1 - found <= idx <= self.keys[found_index + 1 - found] - 1 + found
154-
let lhs = self.keys[found_index];
155-
let rhs = self.keys[found_index + 1 - found];
154+
let lhs = self.keys[found_index as u32];
155+
let rhs = self.keys[(found_index + 1 - found) as u32];
156156
let lhs_condition = idx - lhs - 1 + found;
157157
let rhs_condition = rhs - 1 + found - idx;
158158
lhs_condition.assert_max_bit_size::<32>();
@@ -161,7 +161,7 @@ where
161161
// self.keys[i] maps to self.values[i+1]
162162
// however...if we did not find a non-sparse entry, we want to return self.values[0] (the default value)
163163
let value_index = (found_index + 1) * found;
164-
self.values[value_index]
164+
self.values[value_index as u32]
165165
}
166166
}
167167

src/mut_sparse_array.nr

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ where
169169
unsafe { self.__check_if_can_insert(found) };
170170

171171
let lhs_index = found_index;
172-
let rhs_index = self.linked_keys[found_index];
172+
let rhs_index = self.linked_keys[found_index as u32];
173173

174174
assert(found * found == found);
175175

@@ -181,8 +181,8 @@ where
181181
// case 2 can be modified to `self.keys[found_index] + 1 <= idx <= self.keys[found_index + 1] - 1
182182
// combine the two into the following single statement:
183183
// `self.keys[found_index] + 1 - found <= idx <= self.keys[found_index + 1 - found] - 1 + found
184-
let lhs = self.keys[lhs_index];
185-
let rhs = self.keys[rhs_index];
184+
let lhs = self.keys[lhs_index as u32];
185+
let rhs = self.keys[rhs_index as u32];
186186
let lhs_condition = idx - lhs - 1 + found;
187187
let rhs_condition = rhs - 1 + found - idx;
188188
ComparisonFuncs::assert_greater_than_or_equal(lhs_condition, 0);
@@ -193,15 +193,15 @@ where
193193
// lhs points to tail_ptr
194194
// tail_ptr points to rhs
195195
if (found == 0) {
196-
self.keys[self.tail_ptr] = idx;
196+
self.keys[self.tail_ptr as u32] = idx;
197197

198-
self.linked_keys[found_index] = self.tail_ptr * (1 - found) + found * rhs_index;
198+
self.linked_keys[found_index as u32] = self.tail_ptr * (1 - found) + found * rhs_index;
199199

200-
self.linked_keys[self.tail_ptr] = rhs_index * (1 - found);
201-
self.values[self.tail_ptr + 1] = value;
200+
self.linked_keys[self.tail_ptr as u32] = rhs_index * (1 - found);
201+
self.values[(self.tail_ptr + 1) as u32] = value;
202202
self.tail_ptr += 1;
203203
} else {
204-
self.values[found_index + 1] = value;
204+
self.values[(found_index + 1) as u32] = value;
205205
}
206206
}
207207

@@ -211,7 +211,7 @@ where
211211
assert(found * found == found);
212212

213213
let lhs_index = found_index;
214-
let rhs_index = self.linked_keys[found_index];
214+
let rhs_index = self.linked_keys[found_index as u32];
215215

216216
assert(found * found == found);
217217

@@ -223,8 +223,8 @@ where
223223
// case 2 can be modified to `self.keys[found_index] + 1 <= idx <= self.keys[found_index + 1] - 1
224224
// combine the two into the following single statement:
225225
// `self.keys[found_index] + 1 - found <= idx <= self.keys[found_index + 1 - found] - 1 + found
226-
let lhs = self.keys[lhs_index];
227-
let rhs = self.keys[rhs_index];
226+
let lhs = self.keys[lhs_index as u32];
227+
let rhs = self.keys[rhs_index as u32];
228228
let lhs_condition = idx - lhs - 1 + found;
229229
let rhs_condition = rhs - 1 + found - idx;
230230
ComparisonFuncs::assert_greater_than_or_equal(lhs_condition, 0);
@@ -233,7 +233,7 @@ where
233233
// lhs_condition.assert_max_bit_size::<32>();
234234
// rhs_condition.assert_max_bit_size::<32>();
235235
let value_index = (lhs_index + 1) * found;
236-
self.values[value_index]
236+
self.values[value_index as u32]
237237
}
238238
}
239239

0 commit comments

Comments
 (0)