This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 462db3d5bea [fix](compile) fix macos compile error (#25944)
462db3d5bea is described below
commit 462db3d5bea5fe3e4e3b9c6e592b91ad2aff6ba4
Author: TengJianPing <[email protected]>
AuthorDate: Tue Oct 31 11:44:56 2023 +0800
[fix](compile) fix macos compile error (#25944)
---
be/src/vec/core/accurate_comparison.h | 28 ++++++++++++++--------------
be/src/vec/core/decomposed_float.h | 12 +++++++-----
be/src/vec/core/extended_types.h | 8 ++------
3 files changed, 23 insertions(+), 25 deletions(-)
diff --git a/be/src/vec/core/accurate_comparison.h
b/be/src/vec/core/accurate_comparison.h
index 31af73711cf..dc3d54ebb58 100644
--- a/be/src/vec/core/accurate_comparison.h
+++ b/be/src/vec/core/accurate_comparison.h
@@ -179,25 +179,25 @@ bool lessOp(A a, B b) {
}
/// int vs int
- if constexpr (is_integer<A> && is_integer<B>) {
+ if constexpr (wide::is_integer<A> && wide::is_integer<B>) {
/// same signedness
- if constexpr (is_signed_v<A> == is_signed_v<B>) {
+ if constexpr (wide::is_signed_v<A> == wide::is_signed_v<B>) {
return a < b;
}
/// different signedness
- if constexpr (is_signed_v<A> && !is_signed_v<B>) {
+ if constexpr (wide::is_signed_v<A> && !wide::is_signed_v<B>) {
return a < 0 || static_cast<std::make_unsigned_t<A>>(a) < b;
}
- if constexpr (!is_signed_v<A> && is_signed_v<B>) {
+ if constexpr (!wide::is_signed_v<A> && wide::is_signed_v<B>) {
return b >= 0 && a < static_cast<std::make_unsigned_t<B>>(b);
}
}
/// int vs float
- if constexpr (is_integer<A> && std::is_floating_point_v<B>) {
+ if constexpr (wide::is_integer<A> && std::is_floating_point_v<B>) {
if constexpr (sizeof(A) <= 4) {
return static_cast<double>(a) < static_cast<double>(b);
}
@@ -205,7 +205,7 @@ bool lessOp(A a, B b) {
return DecomposedFloat<B>(b).greater(a);
}
- if constexpr (std::is_floating_point_v<A> && is_integer<B>) {
+ if constexpr (std::is_floating_point_v<A> && wide::is_integer<B>) {
if constexpr (sizeof(B) <= 4) {
return static_cast<double>(a) < static_cast<double>(b);
}
@@ -213,8 +213,8 @@ bool lessOp(A a, B b) {
return DecomposedFloat<A>(a).less(b);
}
- static_assert(is_integer<A> || std::is_floating_point_v<A>);
- static_assert(is_integer<B> || std::is_floating_point_v<B>);
+ static_assert(wide::is_integer<A> || std::is_floating_point_v<A>);
+ static_assert(wide::is_integer<B> || std::is_floating_point_v<B>);
__builtin_unreachable();
}
@@ -258,25 +258,25 @@ bool equalsOp(A a, B b) {
}
/// int vs int
- if constexpr (is_integer<A> && is_integer<B>) {
+ if constexpr (wide::is_integer<A> && wide::is_integer<B>) {
/// same signedness
- if constexpr (is_signed_v<A> == is_signed_v<B>) {
+ if constexpr (wide::is_signed_v<A> == wide::is_signed_v<B>) {
return a == b;
}
/// different signedness
- if constexpr (is_signed_v<A> && !is_signed_v<B>) {
+ if constexpr (wide::is_signed_v<A> && !wide::is_signed_v<B>) {
return a >= 0 && static_cast<std::make_unsigned_t<A>>(a) == b;
}
- if constexpr (!is_signed_v<A> && is_signed_v<B>) {
+ if constexpr (!wide::is_signed_v<A> && wide::is_signed_v<B>) {
return b >= 0 && a == static_cast<std::make_unsigned_t<B>>(b);
}
}
/// int vs float
- if constexpr (is_integer<A> && std::is_floating_point_v<B>) {
+ if constexpr (wide::is_integer<A> && std::is_floating_point_v<B>) {
if constexpr (sizeof(A) <= 4) {
return static_cast<double>(a) == static_cast<double>(b);
}
@@ -284,7 +284,7 @@ bool equalsOp(A a, B b) {
return DecomposedFloat<B>(b).equals(a);
}
- if constexpr (std::is_floating_point_v<A> && is_integer<B>) {
+ if constexpr (std::is_floating_point_v<A> && wide::is_integer<B>) {
if constexpr (sizeof(B) <= 4) {
return static_cast<double>(a) == static_cast<double>(b);
}
diff --git a/be/src/vec/core/decomposed_float.h
b/be/src/vec/core/decomposed_float.h
index a4784e3f132..bccfd0cb43d 100644
--- a/be/src/vec/core/decomposed_float.h
+++ b/be/src/vec/core/decomposed_float.h
@@ -113,16 +113,16 @@ struct DecomposedFloat {
}
/// The case of the most negative integer
- if constexpr (is_signed_v<Int>) {
+ if constexpr (wide::is_signed_v<Int>) {
if (rhs == std::numeric_limits<Int>::lowest()) {
assert(isNegative());
if (normalizedExponent() <
- static_cast<int16_t>(8 * sizeof(Int) - is_signed_v<Int>)) {
+ static_cast<int16_t>(8 * sizeof(Int) -
wide::is_signed_v<Int>)) {
return 1;
}
if (normalizedExponent() >
- static_cast<int16_t>(8 * sizeof(Int) - is_signed_v<Int>)) {
+ static_cast<int16_t>(8 * sizeof(Int) -
wide::is_signed_v<Int>)) {
return -1;
}
@@ -134,7 +134,8 @@ struct DecomposedFloat {
}
/// Too large number: abs(float) > abs(rhs). Also the case with
infinities and NaN.
- if (normalizedExponent() >= static_cast<int16_t>(8 * sizeof(Int) -
is_signed_v<Int>)) {
+ if (normalizedExponent() >=
+ static_cast<int16_t>(8 * sizeof(Int) - wide::is_signed_v<Int>)) {
return isNegative() ? -1 : 1;
}
@@ -149,7 +150,8 @@ struct DecomposedFloat {
}
/// Larger octave: abs(rhs) > abs(float)
- if (normalizedExponent() + 1 < static_cast<int16_t>(8 * sizeof(Int) -
is_signed_v<Int>) &&
+ if (normalizedExponent() + 1 <
+ static_cast<int16_t>(8 * sizeof(Int) -
wide::is_signed_v<Int>) &&
uint_rhs >= (static_cast<UInt>(1) << (normalizedExponent() + 1))) {
return isNegative() ? 1 : -1;
}
diff --git a/be/src/vec/core/extended_types.h b/be/src/vec/core/extended_types.h
index d7e088dd45f..d14e9673da6 100644
--- a/be/src/vec/core/extended_types.h
+++ b/be/src/vec/core/extended_types.h
@@ -32,6 +32,7 @@ static_assert(sizeof(UInt256) == 32);
/// The standard library type traits, such as std::is_arithmetic, with one
exception
/// (std::common_type), are "set in stone". Attempting to specialize them
causes undefined behavior.
/// So instead of using the std type_traits, we use our own version which
allows extension.
+namespace wide {
template <typename T>
struct is_signed // NOLINT(readability-identifier-naming)
{
@@ -58,6 +59,7 @@ inline constexpr bool is_unsigned_v = is_unsigned<T>::value;
template <class T>
concept is_integer =
std::is_integral_v<T> || std::is_same_v<T, Int256> ||
std::is_same_v<T, UInt256>;
+} // namespace wide
namespace std {
template <>
@@ -69,9 +71,6 @@ struct make_unsigned<UInt256> {
using type = UInt256;
};
-template <typename T>
-using make_unsigned_t = typename make_unsigned<T>::type;
-
template <>
struct make_signed<Int256> {
using type = Int256;
@@ -80,7 +79,4 @@ template <>
struct make_signed<UInt256> {
using type = Int256;
};
-
-template <typename T>
-using make_signed_t = typename make_signed<T>::type;
} // namespace std
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]