Skip to content

Commit

Permalink
Rename misleading UNION_FIELD_SIZE
Browse files Browse the repository at this point in the history
  • Loading branch information
gio256 committed Jul 3, 2024
1 parent 994da97 commit 1deb398
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions evm_arithmetization/src/cpu/columns/general.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ pub(crate) struct CpuExceptionView<T: Copy> {
/// Exception code as little-endian bits.
pub(crate) exc_code_bits: [T; 3],
/// Reserve the unused columns.
_padding_columns: [T; UNION_FIELD_SIZE - 3],
_padding_columns: [T; NUM_UNION_COLUMNS - 3],
}

/// View of the `CpuGeneralColumns` storing pseudo-inverses used to prove logic
Expand All @@ -143,7 +143,7 @@ pub(crate) struct CpuJumpsView<T: Copy> {
/// Pseudoinverse of `cond.iter().sum()`. Used to check `should_jump`.
pub(crate) cond_sum_pinv: T,
/// Reserve the unused columns.
_padding_columns: [T; UNION_FIELD_SIZE - 2],
_padding_columns: [T; NUM_UNION_COLUMNS - 2],
}

/// View of the first `CpuGeneralColumns` storing a pseudoinverse used to prove
Expand All @@ -155,7 +155,7 @@ pub(crate) struct CpuShiftView<T: Copy> {
/// sum(displacement[1..]) or zero if the sum is zero.
pub(crate) high_limb_sum_inv: T,
/// Reserve the unused columns.
_padding_columns: [T; UNION_FIELD_SIZE - 1],
_padding_columns: [T; NUM_UNION_COLUMNS - 1],
}

/// View of the last four `CpuGeneralColumns` storing stack-related variables.
Expand All @@ -176,7 +176,7 @@ pub(crate) struct CpuStackView<T: Copy> {
/// stack overflow.
pub(crate) stack_len_bounds_aux: T,
/// Reserve the unused columns.
_padding_columns: [T; UNION_FIELD_SIZE - 8],
_padding_columns: [T; NUM_UNION_COLUMNS - 8],
}

/// Number of columns shared by all the views of `CpuGeneralColumnsView`.
Expand All @@ -187,8 +187,8 @@ pub(crate) const NUM_SHARED_COLUMNS: usize = size_of::<CpuGeneralColumnsView<u8>
/// We assert that this is the same as [`NUM_SHARED_COLUMNS`], but we define
/// it in order to determine the number of padding columns to add to each field
/// without creating a cycle for rustc.
const UNION_FIELD_SIZE: usize = size_of::<CpuLogicView<u8>>();
const_assert!(UNION_FIELD_SIZE == NUM_SHARED_COLUMNS);
const NUM_UNION_COLUMNS: usize = size_of::<CpuLogicView<u8>>();
const_assert!(NUM_UNION_COLUMNS == NUM_SHARED_COLUMNS);

/// Assert that each field of the [`CpuGeneralColumnsView`] union contains the
/// correct number of columns.
Expand Down

0 comments on commit 1deb398

Please sign in to comment.