Skip to content

Commit

Permalink
Address review
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadrieril committed Apr 23, 2024
1 parent 6eb1e5b commit f3890eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions charon/src/transform/remove_read_discriminant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,9 @@ impl<'a, 'tcx, 'ctx> Visitor<'a, 'tcx, 'ctx> {
};
}
Err(st2) => {
// The discriminant read is not followed by a `SwitchInt`. We replace `_x =
// Discr(_y)` with `match _y { 0 => { _x = 0 }, 1 => { _x = 1; }, .. }`.
// The discriminant read is not followed by a `SwitchInt`. This can happen
// in optimized MIR. We replace `_x = Discr(_y)` with `match _y { 0 => { _x
// = 0 }, 1 => { _x = 1; }, .. }`.
let targets = variants
.iter_indexed_values()
.map(|(id, variant)| {
Expand Down
1 change: 1 addition & 0 deletions charon/src/values_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ impl ScalarValue {
ScalarValue::I128(v) => v as u128,
}
}

pub fn from_bits(ty: IntegerTy, bits: u128) -> Self {
Self::from_le_bytes(ty, bits.to_le_bytes())
}
Expand Down

0 comments on commit f3890eb

Please sign in to comment.