Use cast instead of .try_into().unwrap()

This commit is contained in:
Ajai Nelson 2023-04-20 01:05:38 -04:00
parent 3dbec4760b
commit e6de71ccfb
No known key found for this signature in database
GPG key ID: 5744FCFB528CB779

View file

@ -2881,11 +2881,7 @@ fn encode_f32_to_imm8(imm: f32) -> Option<u8> {
// The fraction is the same as the first 4 bits of the original fraction.
let ret_frac = frac_begin;
Some(
(ret_sign | ret_exp_first | ret_exp_last | ret_frac)
.try_into()
.unwrap(),
)
Some((ret_sign | ret_exp_first | ret_exp_last | ret_frac) as u8)
}
/// Encode a 64-bit float into an 8-bit immediate for FMOV.
@ -2932,11 +2928,7 @@ fn encode_f64_to_imm8(imm: f64) -> Option<u8> {
// The fraction is the same as the first 4 bits of the original fraction.
let ret_frac = frac_begin;
Some(
(ret_sign | ret_exp_first | ret_exp_last | ret_frac)
.try_into()
.unwrap(),
)
Some((ret_sign | ret_exp_first | ret_exp_last | ret_frac) as u8)
}
/// `FMOV Sd/Dd, imm8` -> Move imm8 to a float register.