mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 08:06:40 +00:00
[libc++][modules] Remove dependency on __algorithm/max from hypot.h (#107150)
That dependency was added recently when we made improvements to std::hypot, but that resulted in `__math` depending on `__algorithm`, which is a very heavyweight module. This patch uses `__math::fmax` instead.
This commit is contained in:
parent
d21e731c42
commit
23f6c3370b
@ -9,10 +9,10 @@
|
||||
#ifndef _LIBCPP___MATH_HYPOT_H
|
||||
#define _LIBCPP___MATH_HYPOT_H
|
||||
|
||||
#include <__algorithm/max.h>
|
||||
#include <__config>
|
||||
#include <__math/abs.h>
|
||||
#include <__math/exponential_functions.h>
|
||||
#include <__math/min_max.h>
|
||||
#include <__math/roots.h>
|
||||
#include <__type_traits/enable_if.h>
|
||||
#include <__type_traits/is_arithmetic.h>
|
||||
@ -62,7 +62,7 @@ _LIBCPP_HIDE_FROM_ABI _Real __hypot(_Real __x, _Real __y, _Real __z) {
|
||||
const _Real __overflow_scale = __math::ldexp(_Real(1), -(__exp + 20));
|
||||
|
||||
// Scale arguments depending on their size
|
||||
const _Real __max_abs = std::max(__math::fabs(__x), std::max(__math::fabs(__y), __math::fabs(__z)));
|
||||
const _Real __max_abs = __math::fmax(__math::fabs(__x), __math::fmax(__math::fabs(__y), __math::fabs(__z)));
|
||||
_Real __scale;
|
||||
if (__max_abs > __overflow_threshold) { // x*x + y*y + z*z might overflow
|
||||
__scale = __overflow_scale;
|
||||
|
@ -131,8 +131,6 @@ chrono type_traits
|
||||
chrono vector
|
||||
chrono version
|
||||
cinttypes cstdint
|
||||
cmath cstddef
|
||||
cmath initializer_list
|
||||
cmath limits
|
||||
cmath type_traits
|
||||
cmath version
|
||||
|
|
@ -131,8 +131,6 @@ chrono type_traits
|
||||
chrono vector
|
||||
chrono version
|
||||
cinttypes cstdint
|
||||
cmath cstddef
|
||||
cmath initializer_list
|
||||
cmath limits
|
||||
cmath type_traits
|
||||
cmath version
|
||||
|
|
@ -132,8 +132,6 @@ chrono type_traits
|
||||
chrono vector
|
||||
chrono version
|
||||
cinttypes cstdint
|
||||
cmath cstddef
|
||||
cmath initializer_list
|
||||
cmath limits
|
||||
cmath type_traits
|
||||
cmath version
|
||||
|
|
@ -132,8 +132,6 @@ chrono type_traits
|
||||
chrono vector
|
||||
chrono version
|
||||
cinttypes cstdint
|
||||
cmath cstddef
|
||||
cmath initializer_list
|
||||
cmath limits
|
||||
cmath type_traits
|
||||
cmath version
|
||||
|
|
@ -137,8 +137,6 @@ chrono type_traits
|
||||
chrono vector
|
||||
chrono version
|
||||
cinttypes cstdint
|
||||
cmath cstddef
|
||||
cmath initializer_list
|
||||
cmath limits
|
||||
cmath type_traits
|
||||
cmath version
|
||||
|
|
@ -84,8 +84,6 @@ chrono string_view
|
||||
chrono vector
|
||||
chrono version
|
||||
cinttypes cstdint
|
||||
cmath cstddef
|
||||
cmath initializer_list
|
||||
cmath limits
|
||||
cmath version
|
||||
codecvt cctype
|
||||
|
|
@ -84,8 +84,6 @@ chrono string_view
|
||||
chrono vector
|
||||
chrono version
|
||||
cinttypes cstdint
|
||||
cmath cstddef
|
||||
cmath initializer_list
|
||||
cmath limits
|
||||
cmath version
|
||||
codecvt cctype
|
||||
|
|
Loading…
x
Reference in New Issue
Block a user