#include "system_wrappers/include/denormal_disabler.h"
#include "rtc_base/checks.h"
namespace webrtc {
namespace {
#if defined(WEBRTC_ARCH_X86_FAMILY) && defined(__clang__)
#define WEBRTC_DENORMAL_DISABLER_X86_SUPPORTED
#endif
#if defined(WEBRTC_DENORMAL_DISABLER_X86_SUPPORTED) || \
defined(WEBRTC_ARCH_ARM_FAMILY)
#define WEBRTC_DENORMAL_DISABLER_SUPPORTED
#endif
constexpr int kUnspecifiedStatusWord = …;
#if defined(WEBRTC_DENORMAL_DISABLER_SUPPORTED)
#if defined(WEBRTC_DENORMAL_DISABLER_X86_SUPPORTED)
constexpr int kDenormalBitMask = …;
#elif defined(WEBRTC_ARCH_ARM_FAMILY)
constexpr int kDenormalBitMask = 1 << 24;
#endif
int ReadStatusWord() { … }
void SetStatusWord(int status_word) { … }
constexpr bool DenormalsEnabled(int status_word) { … }
#endif
}
#if defined(WEBRTC_DENORMAL_DISABLER_SUPPORTED)
DenormalDisabler::DenormalDisabler() : … { … }
DenormalDisabler::DenormalDisabler(bool enabled)
: … { … }
bool DenormalDisabler::IsSupported() { … }
DenormalDisabler::~DenormalDisabler() { … }
#else
DenormalDisabler::DenormalDisabler() : DenormalDisabler(false) {}
DenormalDisabler::DenormalDisabler(bool enabled)
: status_word_(kUnspecifiedStatusWord), disabling_activated_(false) {}
bool DenormalDisabler::IsSupported() {
return false;
}
DenormalDisabler::~DenormalDisabler() = default;
#endif
}