Skip to content

Commit

Permalink
chore: remove unnecessary is_integral_bit_size function (#9352)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench authored Oct 24, 2024
1 parent 66f31c7 commit ac8e6d7
Showing 1 changed file with 2 additions and 24 deletions.
26 changes: 2 additions & 24 deletions avm-transpiler/src/transpile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,7 @@ pub fn brillig_to_avm(
],
});
}
BrilligOpcode::BinaryIntOp { destination, op, bit_size, lhs, rhs } => {
assert!(
is_integral_bit_size(*bit_size),
"BinaryIntOp bit size should be integral: {:?}",
brillig_instr
);
BrilligOpcode::BinaryIntOp { destination, op, lhs, rhs, .. } => {
let bits_needed =
[*lhs, *rhs, *destination].iter().map(bits_needed_for).max().unwrap();
assert!(
Expand Down Expand Up @@ -189,12 +184,7 @@ pub fn brillig_to_avm(
],
});
}
BrilligOpcode::Not { destination, source, bit_size } => {
assert!(
is_integral_bit_size(*bit_size),
"Not bit size should be integral: {:?}",
brillig_instr
);
BrilligOpcode::Not { destination, source, .. } => {
let bits_needed =
[*source, *destination].iter().map(bits_needed_for).max().unwrap();
assert!(
Expand Down Expand Up @@ -1421,18 +1411,6 @@ pub fn map_brillig_pcs_to_avm_pcs(brillig_bytecode: &[BrilligOpcode<FieldElement
pc_map
}

fn is_integral_bit_size(bit_size: IntegerBitSize) -> bool {
matches!(
bit_size,
IntegerBitSize::U1
| IntegerBitSize::U8
| IntegerBitSize::U16
| IntegerBitSize::U32
| IntegerBitSize::U64
| IntegerBitSize::U128
)
}

fn tag_from_bit_size(bit_size: BitSize) -> AvmTypeTag {
match bit_size {
BitSize::Integer(IntegerBitSize::U1) => AvmTypeTag::UINT1,
Expand Down

0 comments on commit ac8e6d7

Please sign in to comment.