Skip to content

Commit

Permalink
reduce branching when checking for MOD operations
Browse files Browse the repository at this point in the history
  • Loading branch information
mhasel committed Mar 11, 2024
1 parent df6170c commit 27a4d49
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/validation/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1354,11 +1354,12 @@ fn validate_assignment_type_sizes<T: AnnotationMap>(
.into_iter()
.for_each(|(k, v)| map.entry(k).or_default().extend(v));
// the RHS type in a MOD expression has no impact on the resulting value type
if !matches!(operator, Operator::Modulo) {
get_expression_types_and_locations(right, context, lhs_is_signed_int)
.into_iter()
.for_each(|(k, v)| map.entry(k).or_default().extend(v));
}
if matches!(operator, Operator::Modulo) {
return map
};
get_expression_types_and_locations(right, context, lhs_is_signed_int)
.into_iter()
.for_each(|(k, v)| map.entry(k).or_default().extend(v));
}
AstStatement::UnaryExpression(UnaryExpression { operator, value })
if !operator.is_comparison_operator() =>
Expand Down

0 comments on commit 27a4d49

Please sign in to comment.