[libc][NFC] Make explicit uint16_t casts in fenv
This commit is contained in:
parent
7f24e574d4
commit
40a55fff05
@ -203,7 +203,8 @@ static inline int get_except() {
|
||||
static inline int clear_except(int excepts) {
|
||||
internal::X87StateDescriptor state;
|
||||
internal::get_x87_state_descriptor(state);
|
||||
state.status_word &= ~internal::get_status_value_for_except(excepts);
|
||||
state.status_word &=
|
||||
static_cast<uint16_t>(~internal::get_status_value_for_except(excepts));
|
||||
internal::write_x87_state_descriptor(state);
|
||||
|
||||
uint32_t mxcsr = internal::get_mxcsr();
|
||||
@ -215,8 +216,8 @@ static inline int clear_except(int excepts) {
|
||||
static inline int test_except(int excepts) {
|
||||
uint16_t status_value = internal::get_status_value_for_except(excepts);
|
||||
// Check both x87 status word and MXCSR.
|
||||
return internal::exception_status_to_macro(status_value &
|
||||
internal::get_mxcsr());
|
||||
return internal::exception_status_to_macro(
|
||||
static_cast<uint16_t>(status_value & internal::get_mxcsr()));
|
||||
}
|
||||
|
||||
// Sets the exception flags but does not trigger the exception handler.
|
||||
|
||||
@ -20,7 +20,7 @@ LLVM_LIBC_FUNCTION(int, fesetexceptflag,
|
||||
// can fit in int type.
|
||||
static_assert(sizeof(int) >= sizeof(fexcept_t),
|
||||
"fexcept_t value cannot fit in an int value.");
|
||||
int excepts_to_set = static_cast<const int>(*flagp) & excepts;
|
||||
int excepts_to_set = static_cast<int>(*flagp) & excepts;
|
||||
fputil::clear_except(FE_ALL_EXCEPT);
|
||||
return fputil::set_except(excepts_to_set);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user