Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make some fields private for instruction table #59

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions crates/brainfuck_prover/src/components/instruction/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ use crate::utils::VALID_INSTRUCTIONS;
#[derive(Debug, Default, PartialEq, Eq, Clone)]
pub struct InstructionTableRow {
/// Instruction pointer: points to the current instruction in the program.
pub ip: BaseField,
ip: BaseField,
/// Current instruction: the instruction at the current instruction pointer.
pub ci: BaseField,
ci: BaseField,
/// Next instruction:
/// - The instruction that follows `ci` in the program,
/// - 0 if out of bounds.
pub ni: BaseField,
ni: BaseField,
}

/// Represents the Instruction Table, which holds the instruction sequence
Expand All @@ -32,7 +32,7 @@ pub struct InstructionTableRow {
#[derive(Debug, Default, PartialEq, Eq, Clone)]
pub struct InstructionTable {
/// A vector of [`InstructionTableRow`] representing the table rows.
pub table: Vec<InstructionTableRow>,
table: Vec<InstructionTableRow>,
}

impl InstructionTable {
Expand Down Expand Up @@ -62,7 +62,7 @@ impl InstructionTable {
/// * `row` - The [`InstructionTableRow`] to add to the table.
///
/// This method pushes a new [`InstructionTableRow`] onto the `table` vector.
pub fn add_row(&mut self, row: InstructionTableRow) {
fn add_row(&mut self, row: InstructionTableRow) {
self.table.push(row);
}

Expand Down Expand Up @@ -93,7 +93,7 @@ impl InstructionTable {
/// # Returns
/// An `Option` containing a reference to the last [`InstructionTableRow`] in the table,
/// or `None` if the table is empty.
pub fn last_row(&self) -> Option<&InstructionTableRow> {
fn last_row(&self) -> Option<&InstructionTableRow> {
self.table.last()
}
}
Expand Down