Skip to content

Commit

Permalink
Simplify type conversion.
Browse files Browse the repository at this point in the history
  • Loading branch information
reitermarkus committed Mar 14, 2023
1 parent d0086e9 commit b6a242e
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions bindgen/clang.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2125,11 +2125,7 @@ impl EvalResult {

if unsafe { clang_EvalResult_isUnsignedInt(self.x) } != 0 {
let value = unsafe { clang_EvalResult_getAsUnsigned(self.x) };
if value as u128 > i128::MAX as u128 {
return None;
}

return Some(value as i128);
return i128::try_from(value).ok()
}

let value = unsafe { clang_EvalResult_getAsLongLong(self.x) };
Expand Down

0 comments on commit b6a242e

Please sign in to comment.