diff --git a/Nargo.toml b/Nargo.toml index 55c004c..0a5fa61 100644 --- a/Nargo.toml +++ b/Nargo.toml @@ -5,4 +5,4 @@ authors = [""] compiler_version = ">=0.36.0" [dependencies] -sort = { tag = "v0.2.3", git = "https://github.com/noir-lang/noir_sort" } +sort = { tag = "v0.3.0", git = "https://github.com/noir-lang/noir_sort" } diff --git a/src/lib.nr b/src/lib.nr index bcc6df7..d8210bb 100644 --- a/src/lib.nr +++ b/src/lib.nr @@ -151,8 +151,8 @@ where // case 2 can be modified to `self.keys[found_index] + 1 <= idx <= self.keys[found_index + 1] - 1 // combine the two into the following single statement: // `self.keys[found_index] + 1 - found <= idx <= self.keys[found_index + 1 - found] - 1 + found - let lhs = self.keys[found_index]; - let rhs = self.keys[found_index + 1 - found]; + let lhs = self.keys[found_index as u32]; + let rhs = self.keys[(found_index + 1 - found) as u32]; let lhs_condition = idx - lhs - 1 + found; let rhs_condition = rhs - 1 + found - idx; lhs_condition.assert_max_bit_size::<32>(); @@ -161,7 +161,7 @@ where // self.keys[i] maps to self.values[i+1] // however...if we did not find a non-sparse entry, we want to return self.values[0] (the default value) let value_index = (found_index + 1) * found; - self.values[value_index] + self.values[value_index as u32] } } diff --git a/src/mut_sparse_array.nr b/src/mut_sparse_array.nr index f254260..562b81e 100644 --- a/src/mut_sparse_array.nr +++ b/src/mut_sparse_array.nr @@ -169,7 +169,7 @@ where unsafe { self.__check_if_can_insert(found) }; let lhs_index = found_index; - let rhs_index = self.linked_keys[found_index]; + let rhs_index = self.linked_keys[found_index as u32]; assert(found * found == found); @@ -181,8 +181,8 @@ where // case 2 can be modified to `self.keys[found_index] + 1 <= idx <= self.keys[found_index + 1] - 1 // combine the two into the following single statement: // `self.keys[found_index] + 1 - found <= idx <= self.keys[found_index + 1 - found] - 1 + found - let lhs = self.keys[lhs_index]; - let rhs = self.keys[rhs_index]; + let lhs = self.keys[lhs_index as u32]; + let rhs = self.keys[rhs_index as u32]; let lhs_condition = idx - lhs - 1 + found; let rhs_condition = rhs - 1 + found - idx; ComparisonFuncs::assert_greater_than_or_equal(lhs_condition, 0); @@ -193,15 +193,15 @@ where // lhs points to tail_ptr // tail_ptr points to rhs if (found == 0) { - self.keys[self.tail_ptr] = idx; + self.keys[self.tail_ptr as u32] = idx; - self.linked_keys[found_index] = self.tail_ptr * (1 - found) + found * rhs_index; + self.linked_keys[found_index as u32] = self.tail_ptr * (1 - found) + found * rhs_index; - self.linked_keys[self.tail_ptr] = rhs_index * (1 - found); - self.values[self.tail_ptr + 1] = value; + self.linked_keys[self.tail_ptr as u32] = rhs_index * (1 - found); + self.values[(self.tail_ptr + 1) as u32] = value; self.tail_ptr += 1; } else { - self.values[found_index + 1] = value; + self.values[(found_index + 1) as u32] = value; } } @@ -211,7 +211,7 @@ where assert(found * found == found); let lhs_index = found_index; - let rhs_index = self.linked_keys[found_index]; + let rhs_index = self.linked_keys[found_index as u32]; assert(found * found == found); @@ -223,8 +223,8 @@ where // case 2 can be modified to `self.keys[found_index] + 1 <= idx <= self.keys[found_index + 1] - 1 // combine the two into the following single statement: // `self.keys[found_index] + 1 - found <= idx <= self.keys[found_index + 1 - found] - 1 + found - let lhs = self.keys[lhs_index]; - let rhs = self.keys[rhs_index]; + let lhs = self.keys[lhs_index as u32]; + let rhs = self.keys[rhs_index as u32]; let lhs_condition = idx - lhs - 1 + found; let rhs_condition = rhs - 1 + found - idx; ComparisonFuncs::assert_greater_than_or_equal(lhs_condition, 0); @@ -233,7 +233,7 @@ where // lhs_condition.assert_max_bit_size::<32>(); // rhs_condition.assert_max_bit_size::<32>(); let value_index = (lhs_index + 1) * found; - self.values[value_index] + self.values[value_index as u32] } }