Skip to content

Commit

Permalink
Update compiler/noirc_evaluator/src/ssa/ssa_gen/context.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
jfecher authored Jan 8, 2024
1 parent 474aeaa commit 7da299c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions compiler/noirc_evaluator/src/ssa/ssa_gen/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -684,13 +684,11 @@ impl<'a> FunctionContext<'a> {
// we're narrowing the type size.
let incoming_type_size = self.builder.type_of_value(value).bit_size();
let target_type_size = typ.bit_size();
let truncated_value = if target_type_size < incoming_type_size {
self.builder.insert_truncate(value, target_type_size, incoming_type_size)
} else {
value
};
if target_type_size < incoming_type_size {
value = self.builder.insert_truncate(value, target_type_size, incoming_type_size);
}

self.builder.insert_cast(truncated_value, typ)
self.builder.insert_cast(value, typ)
}

/// Create a const offset of an address for an array load or store
Expand Down

0 comments on commit 7da299c

Please sign in to comment.