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();
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.
// 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);
}