Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Commit

Permalink
update array start to registermemindex as it can be a constant (#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
vezenovm authored Apr 18, 2023
1 parent 69a0798 commit 1547d44
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions brillig_bytecode/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ impl VM {
current_value_index += 1
}
OracleOutput::Array { start, length } => {
let array_id =
self.registers.get(RegisterMemIndex::Register(start));
let array_id = self.registers.get(start);
let heap = &mut self.memory.entry(array_id).or_default().memory_map;
for (i, value) in data.output_values.iter().enumerate() {
heap.insert(i, (*value).into());
Expand Down Expand Up @@ -690,7 +689,8 @@ mod tests {

let oracle_input =
OracleInput::RegisterMemIndex(RegisterMemIndex::Register(RegisterIndex(0)));
let oracle_output = OracleOutput::Array { start: RegisterIndex(3), length: 2 };
let oracle_output =
OracleOutput::Array { start: RegisterMemIndex::Register(RegisterIndex(3)), length: 2 };

let mut oracle_data = OracleData {
name: "get_notes".to_owned(),
Expand Down
2 changes: 1 addition & 1 deletion brillig_bytecode/src/opcodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub enum OracleInput {
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum OracleOutput {
RegisterIndex(RegisterIndex),
Array { start: RegisterIndex, length: usize },
Array { start: RegisterMemIndex, length: usize },
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
Expand Down

0 comments on commit 1547d44

Please sign in to comment.