diff --git a/libc/src/CMakeLists.txt b/libc/src/CMakeLists.txt --- a/libc/src/CMakeLists.txt +++ b/libc/src/CMakeLists.txt @@ -9,7 +9,7 @@ add_subdirectory(stdlib) add_subdirectory(stdio) -if(${LIBC_TARGET_OS} STREQUAL "linux") +if((${LIBC_TARGET_OS} STREQUAL "linux") OR (${LIBC_TARGET_OS} STREQUAL "windows")) add_subdirectory(dirent) add_subdirectory(fcntl) add_subdirectory(pthread) diff --git a/libc/src/__support/FPUtil/x86_64/FEnvImpl.h b/libc/src/__support/FPUtil/x86_64/FEnvImpl.h --- a/libc/src/__support/FPUtil/x86_64/FEnvImpl.h +++ b/libc/src/__support/FPUtil/x86_64/FEnvImpl.h @@ -54,8 +54,8 @@ // support compiling against headers provided by such libcs. static constexpr uint16_t DENORMAL = 0x2; static constexpr uint16_t DIV_BY_ZERO = 0x4; - static constexpr uint16_t OVERFLOW = 0x8; - static constexpr uint16_t UNDERFLOW = 0x10; + static constexpr uint16_t OVERFLOW_F = 0x8; + static constexpr uint16_t UNDERFLOW_F = 0x10; static constexpr uint16_t INEXACT = 0x20; }; @@ -76,8 +76,8 @@ (excepts & __FE_DENORM ? ExceptionFlags::DENORMAL : 0) | #endif // __FE_DENORM (excepts & FE_DIVBYZERO ? ExceptionFlags::DIV_BY_ZERO : 0) | - (excepts & FE_OVERFLOW ? ExceptionFlags::OVERFLOW : 0) | - (excepts & FE_UNDERFLOW ? ExceptionFlags::UNDERFLOW : 0) | + (excepts & FE_OVERFLOW ? ExceptionFlags::OVERFLOW_F : 0) | + (excepts & FE_UNDERFLOW ? ExceptionFlags::UNDERFLOW_F : 0) | (excepts & FE_INEXACT ? ExceptionFlags::INEXACT : 0); } @@ -87,8 +87,8 @@ (status & ExceptionFlags::DENORMAL ? __FE_DENORM : 0) | #endif // __FE_DENORM (status & ExceptionFlags::DIV_BY_ZERO ? FE_DIVBYZERO : 0) | - (status & ExceptionFlags::OVERFLOW ? FE_OVERFLOW : 0) | - (status & ExceptionFlags::UNDERFLOW ? FE_UNDERFLOW : 0) | + (status & ExceptionFlags::OVERFLOW_F ? FE_OVERFLOW : 0) | + (status & ExceptionFlags::UNDERFLOW_F ? FE_UNDERFLOW : 0) | (status & ExceptionFlags::INEXACT ? FE_INEXACT : 0); } @@ -267,10 +267,10 @@ raise_helper(internal::ExceptionFlags::INVALID); if (status_value & internal::ExceptionFlags::DIV_BY_ZERO) raise_helper(internal::ExceptionFlags::DIV_BY_ZERO); - if (status_value & internal::ExceptionFlags::OVERFLOW) - raise_helper(internal::ExceptionFlags::OVERFLOW); - if (status_value & internal::ExceptionFlags::UNDERFLOW) - raise_helper(internal::ExceptionFlags::UNDERFLOW); + if (status_value & internal::ExceptionFlags::OVERFLOW_F) + raise_helper(internal::ExceptionFlags::OVERFLOW_F); + if (status_value & internal::ExceptionFlags::UNDERFLOW_F) + raise_helper(internal::ExceptionFlags::UNDERFLOW_F); if (status_value & internal::ExceptionFlags::INEXACT) raise_helper(internal::ExceptionFlags::INEXACT); #ifdef __FE_DENORM @@ -371,24 +371,24 @@ // The exception flags in the Windows FEnv struct and the MXCSR have almost // reversed bit positions. struct WinExceptionFlags { - static constexpr uint32_t INEXACT = 0x01; - static constexpr uint32_t UNDERFLOW = 0x02; - static constexpr uint32_t OVERFLOW = 0x04; - static constexpr uint32_t DIV_BY_ZERO = 0x08; - static constexpr uint32_t INVALID = 0x10; - static constexpr uint32_t DENORMAL = 0x20; + static constexpr uint32_t INEXACT_WIN = 0x01; + static constexpr uint32_t UNDERFLOW_WIN = 0x02; + static constexpr uint32_t OVERFLOW_WIN = 0x04; + static constexpr uint32_t DIV_BY_ZERO_WIN = 0x08; + static constexpr uint32_t INVALID_WIN = 0x10; + static constexpr uint32_t DENORMAL_WIN = 0x20; // The Windows FEnv struct has a second copy of all of these bits in the high // byte of the 32 bit control word. These are used as the source of truth when // calling fesetenv. static constexpr uint32_t HIGH_OFFSET = 24; - static constexpr uint32_t HIGH_INEXACT = INEXACT << HIGH_OFFSET; - static constexpr uint32_t HIGH_UNDERFLOW = UNDERFLOW << HIGH_OFFSET; - static constexpr uint32_t HIGH_OVERFLOW = OVERFLOW << HIGH_OFFSET; - static constexpr uint32_t HIGH_DIV_BY_ZERO = DIV_BY_ZERO << HIGH_OFFSET; - static constexpr uint32_t HIGH_INVALID = INVALID << HIGH_OFFSET; - static constexpr uint32_t HIGH_DENORMAL = DENORMAL << HIGH_OFFSET; + static constexpr uint32_t HIGH_INEXACT = INEXACT_WIN << HIGH_OFFSET; + static constexpr uint32_t HIGH_UNDERFLOW = UNDERFLOW_WIN << HIGH_OFFSET; + static constexpr uint32_t HIGH_OVERFLOW = OVERFLOW_WIN << HIGH_OFFSET; + static constexpr uint32_t HIGH_DIV_BY_ZERO = DIV_BY_ZERO_WIN << HIGH_OFFSET; + static constexpr uint32_t HIGH_INVALID = INVALID_WIN << HIGH_OFFSET; + static constexpr uint32_t HIGH_DENORMAL = DENORMAL_WIN << HIGH_OFFSET; }; /* @@ -474,8 +474,8 @@ internal::ExceptionFlags::DENORMAL)) << 4; status_word |= (mxcsr & internal::ExceptionFlags::DIV_BY_ZERO) << 1; - status_word |= (mxcsr & internal::ExceptionFlags::OVERFLOW) >> 1; - status_word |= (mxcsr & internal::ExceptionFlags::UNDERFLOW) >> 3; + status_word |= (mxcsr & internal::ExceptionFlags::OVERFLOW_F) >> 1; + status_word |= (mxcsr & internal::ExceptionFlags::UNDERFLOW_F) >> 3; status_word |= (mxcsr & internal::ExceptionFlags::INEXACT) >> 5; status_word |= status_word << WinExceptionFlags::HIGH_OFFSET; @@ -486,8 +486,8 @@ << 7)) >> 3; control_word |= (mxcsr & (internal::ExceptionFlags::DIV_BY_ZERO << 7)) >> 6; - control_word |= (mxcsr & (internal::ExceptionFlags::OVERFLOW << 7)) >> 8; - control_word |= (mxcsr & (internal::ExceptionFlags::UNDERFLOW << 7)) >> 10; + control_word |= (mxcsr & (internal::ExceptionFlags::OVERFLOW_F << 7)) >> 8; + control_word |= (mxcsr & (internal::ExceptionFlags::UNDERFLOW_F << 7)) >> 10; control_word |= (mxcsr & (internal::ExceptionFlags::INEXACT << 7)) >> 12; control_word |= control_word << WinExceptionFlags::HIGH_OFFSET;