Skip to content

Commit

Permalink
increase readability: change negative method name into positive one
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-ferdinand committed Sep 29, 2023
1 parent 19ae021 commit 2c18cdb
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions triton-vm/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ impl LabelledInstruction {
self.op_stack_size_influence() > 0
}

pub const fn does_not_change_op_stack_size(&self) -> bool {
self.op_stack_size_influence() == 0
pub const fn changes_op_stack_size(&self) -> bool {
self.op_stack_size_influence() != 0
}

pub const fn shrinks_op_stack(&self) -> bool {
Expand Down Expand Up @@ -306,8 +306,8 @@ impl<Dest: PartialEq + Default> AnInstruction<Dest> {
self.op_stack_size_influence() > 0
}

pub const fn does_not_change_op_stack_size(&self) -> bool {
self.op_stack_size_influence() == 0
pub const fn changes_op_stack_size(&self) -> bool {
self.op_stack_size_influence() != 0
}

pub const fn shrinks_op_stack(&self) -> bool {
Expand Down Expand Up @@ -891,7 +891,7 @@ mod instruction_tests {
);
assert_eq!(
stack_size_difference == Ordering::Equal,
test_instruction.does_not_change_op_stack_size(),
!test_instruction.changes_op_stack_size(),
"{test_instruction}"
);
assert_eq!(
Expand All @@ -917,8 +917,8 @@ mod instruction_tests {
labelled_instruction.grows_op_stack()
);
assert_eq!(
test_instruction.does_not_change_op_stack_size(),
labelled_instruction.does_not_change_op_stack_size()
test_instruction.changes_op_stack_size(),
labelled_instruction.changes_op_stack_size()
);
assert_eq!(
test_instruction.shrinks_op_stack(),
Expand All @@ -932,7 +932,7 @@ mod instruction_tests {
let labelled_instruction = LabelledInstruction::Label("dummy_label".to_string());
assert_eq!(0, labelled_instruction.op_stack_size_influence());
assert!(!labelled_instruction.grows_op_stack());
assert!(labelled_instruction.does_not_change_op_stack_size());
assert!(!labelled_instruction.changes_op_stack_size());
assert!(!labelled_instruction.shrinks_op_stack());
}
}

0 comments on commit 2c18cdb

Please sign in to comment.