perf(math): inline measured high-low arithmetic call boundaries

This commit is contained in:
KOKO\Mimi
2026-10-14 19:27:46 +09:00
parent 3576f3f6de
commit 8021deefd3
2 changed files with 37 additions and 2 deletions
+14 -2
View File
@@ -55,7 +55,13 @@ inline bool IsFinite(HighLow value) {
return IsFiniteBinary64(value.high) && IsFiniteBinary64(value.low);
}
/// @brief Recovers the exact error of supported finite binary64 addition.
inline HighLow TwoSum(double left, double right) {
/// @note Requests local expansion at the measured MSVC x64 call boundary.
#if defined(_MSC_VER) && defined(_M_X64)
__forceinline
#else
inline
#endif
HighLow TwoSum(double left, double right) {
const double sum = left + right;
const double bridge = sum - left;
const double restored_left = sum - bridge;
@@ -105,7 +111,13 @@ inline HighLow Subtract(HighLow left, HighLow right) {
}
/// @brief Returns the exponent of the least nonzero binary64 significand bit.
/// @pre value is finite and nonzero; gradual underflow is enabled.
inline int LowestBitExponent(double value) {
/// @note Keeps the small integer search inside its measured MSVC x64 caller.
#if defined(_MSC_VER) && defined(_M_X64)
__forceinline
#else
inline
#endif
int LowestBitExponent(double value) {
static_assert(sizeof(double) == sizeof(std::uint64_t) &&
std::numeric_limits<double>::is_iec559 &&
std::numeric_limits<double>::digits == 53);