-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[libc][NFC] Move Sign
type to separate header
#85930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign
type to separate header
This also saves quite a few |
@llvm/pr-subscribers-libc Author: Guillaume Chatelet (gchatelet) ChangesPatch is 33.99 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/85930.diff 54 Files Affected:
diff --git a/libc/src/__support/CMakeLists.txt b/libc/src/__support/CMakeLists.txt
index 4c1f271e1df43a..7b1820d9bf3538 100644
--- a/libc/src/__support/CMakeLists.txt
+++ b/libc/src/__support/CMakeLists.txt
@@ -41,6 +41,14 @@ add_header_library(
libc.src.__support.macros.config
)
+add_header_library(
+ sign
+ HDRS
+ sign.h
+ DEPENDS
+ libc.src.__support.macros.attributes
+)
+
add_header_library(
error_or
HDRS
diff --git a/libc/src/__support/FPUtil/CMakeLists.txt b/libc/src/__support/FPUtil/CMakeLists.txt
index f1c6fba22856dd..4ded70a675ea88 100644
--- a/libc/src/__support/FPUtil/CMakeLists.txt
+++ b/libc/src/__support/FPUtil/CMakeLists.txt
@@ -35,6 +35,7 @@ add_header_library(
libc.src.__support.macros.attributes
libc.src.__support.macros.properties.types
libc.src.__support.math_extras
+ libc.src.__support.sign
libc.src.__support.uint128
)
diff --git a/libc/src/__support/FPUtil/FPBits.h b/libc/src/__support/FPUtil/FPBits.h
index b06b3f7b73959a..155bff2f558102 100644
--- a/libc/src/__support/FPUtil/FPBits.h
+++ b/libc/src/__support/FPUtil/FPBits.h
@@ -17,6 +17,7 @@
#include "src/__support/macros/attributes.h" // LIBC_INLINE, LIBC_INLINE_VAR
#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_FLOAT128
#include "src/__support/math_extras.h" // mask_trailing_ones
+#include "src/__support/sign.h" // Sign
#include <stdint.h>
@@ -32,32 +33,6 @@ enum class FPType {
X86_Binary80,
};
-// A type to interact with floating point type signs.
-// This may be moved outside of 'fputil' if useful.
-struct Sign {
- LIBC_INLINE constexpr bool is_pos() const { return !is_negative; }
- LIBC_INLINE constexpr bool is_neg() const { return is_negative; }
-
- LIBC_INLINE friend constexpr bool operator==(Sign a, Sign b) {
- return a.is_negative == b.is_negative;
- }
- LIBC_INLINE friend constexpr bool operator!=(Sign a, Sign b) {
- return !(a == b);
- }
-
- static const Sign POS;
- static const Sign NEG;
-
-private:
- LIBC_INLINE constexpr explicit Sign(bool is_negative)
- : is_negative(is_negative) {}
-
- bool is_negative;
-};
-
-LIBC_INLINE_VAR constexpr Sign Sign::NEG = Sign(true);
-LIBC_INLINE_VAR constexpr Sign Sign::POS = Sign(false);
-
// The classes hierarchy is as follows:
//
// ┌───────────────────┐
diff --git a/libc/src/__support/FPUtil/fpbits_str.h b/libc/src/__support/FPUtil/fpbits_str.h
index 212265bb9ad4a8..97689867da4de4 100644
--- a/libc/src/__support/FPUtil/fpbits_str.h
+++ b/libc/src/__support/FPUtil/fpbits_str.h
@@ -35,7 +35,6 @@ using ZeroPaddedHexFmt = IntegerToString<
// floating encoding.
template <typename T> LIBC_INLINE cpp::string str(fputil::FPBits<T> x) {
using StorageType = typename fputil::FPBits<T>::StorageType;
- using Sign = fputil::Sign;
if (x.is_nan())
return "(NaN)";
diff --git a/libc/src/__support/sign.h b/libc/src/__support/sign.h
new file mode 100644
index 00000000000000..cba0ec7c0e8b0b
--- /dev/null
+++ b/libc/src/__support/sign.h
@@ -0,0 +1,40 @@
+//===-- A simple sign type --------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_SIGN_H
+#define LLVM_LIBC_SRC___SUPPORT_SIGN_H
+
+#include "src/__support/macros/attributes.h" // LIBC_INLINE, LIBC_INLINE_VAR
+
+// A type to interact with signed arithmetic types.
+struct Sign {
+ LIBC_INLINE constexpr bool is_pos() const { return !is_negative; }
+ LIBC_INLINE constexpr bool is_neg() const { return is_negative; }
+
+ LIBC_INLINE friend constexpr bool operator==(Sign a, Sign b) {
+ return a.is_negative == b.is_negative;
+ }
+
+ LIBC_INLINE friend constexpr bool operator!=(Sign a, Sign b) {
+ return !(a == b);
+ }
+
+ static const Sign POS;
+ static const Sign NEG;
+
+private:
+ LIBC_INLINE constexpr explicit Sign(bool is_negative)
+ : is_negative(is_negative) {}
+
+ bool is_negative;
+};
+
+LIBC_INLINE_VAR constexpr Sign Sign::NEG = Sign(true);
+LIBC_INLINE_VAR constexpr Sign Sign::POS = Sign(false);
+
+#endif // LLVM_LIBC_SRC___SUPPORT_SIGN_H
diff --git a/libc/src/__support/str_to_float.h b/libc/src/__support/str_to_float.h
index 2cf2cfb027243e..f622b7edaa8a72 100644
--- a/libc/src/__support/str_to_float.h
+++ b/libc/src/__support/str_to_float.h
@@ -513,7 +513,6 @@ clinger_fast_path(ExpandedFloat<T> init_num,
RoundDirection round = RoundDirection::Nearest) {
using FPBits = typename fputil::FPBits<T>;
using StorageType = typename FPBits::StorageType;
- using Sign = fputil::Sign;
StorageType mantissa = init_num.mantissa;
int32_t exp10 = init_num.exponent;
@@ -1085,7 +1084,6 @@ template <class T>
LIBC_INLINE StrToNumResult<T> strtofloatingpoint(const char *__restrict src) {
using FPBits = typename fputil::FPBits<T>;
using StorageType = typename FPBits::StorageType;
- using Sign = fputil::Sign;
FPBits result = FPBits();
bool seen_digit = false;
@@ -1223,7 +1221,7 @@ template <class T> LIBC_INLINE StrToNumResult<T> strtonan(const char *arg) {
if (arg[index] == '\0')
nan_mantissa = nan_mantissa_from_ncharseq<T>(cpp::string_view(arg, index));
- result = FPBits::quiet_nan(fputil::Sign::POS, nan_mantissa);
+ result = FPBits::quiet_nan(Sign::POS, nan_mantissa);
return {result.get_val(), 0, error};
}
diff --git a/libc/src/math/generic/acosf.cpp b/libc/src/math/generic/acosf.cpp
index 0c1fdbc6869302..e6e28d43ef61f5 100644
--- a/libc/src/math/generic/acosf.cpp
+++ b/libc/src/math/generic/acosf.cpp
@@ -38,7 +38,7 @@ static constexpr fputil::ExceptValues<float, N_EXCEPTS> ACOSF_EXCEPTS = {{
LLVM_LIBC_FUNCTION(float, acosf, (float x)) {
using FPBits = typename fputil::FPBits<float>;
- using Sign = fputil::Sign;
+
FPBits xbits(x);
uint32_t x_uint = xbits.uintval();
uint32_t x_abs = xbits.uintval() & 0x7fff'ffffU;
diff --git a/libc/src/math/generic/asinf.cpp b/libc/src/math/generic/asinf.cpp
index 6e3a27238ac998..d9133333d2561a 100644
--- a/libc/src/math/generic/asinf.cpp
+++ b/libc/src/math/generic/asinf.cpp
@@ -44,7 +44,7 @@ static constexpr fputil::ExceptValues<float, N_EXCEPTS> ASINF_EXCEPTS_HI = {{
LLVM_LIBC_FUNCTION(float, asinf, (float x)) {
using FPBits = typename fputil::FPBits<float>;
- using Sign = fputil::Sign;
+
FPBits xbits(x);
uint32_t x_uint = xbits.uintval();
uint32_t x_abs = xbits.uintval() & 0x7fff'ffffU;
diff --git a/libc/src/math/generic/atanf.cpp b/libc/src/math/generic/atanf.cpp
index 5f66ea52d0d7ae..4adda429cc041c 100644
--- a/libc/src/math/generic/atanf.cpp
+++ b/libc/src/math/generic/atanf.cpp
@@ -20,7 +20,6 @@ namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, atanf, (float x)) {
using FPBits = typename fputil::FPBits<float>;
- using Sign = fputil::Sign;
constexpr double FINAL_SIGN[2] = {1.0, -1.0};
constexpr double SIGNED_PI_OVER_2[2] = {0x1.921fb54442d18p0,
diff --git a/libc/src/math/generic/atanhf.cpp b/libc/src/math/generic/atanhf.cpp
index fe2c36494a72f8..97fd1b23360067 100644
--- a/libc/src/math/generic/atanhf.cpp
+++ b/libc/src/math/generic/atanhf.cpp
@@ -15,7 +15,7 @@ namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, atanhf, (float x)) {
using FPBits = typename fputil::FPBits<float>;
- using Sign = fputil::Sign;
+
FPBits xbits(x);
Sign sign = xbits.sign();
uint32_t x_abs = xbits.abs().uintval();
diff --git a/libc/src/math/generic/cosf.cpp b/libc/src/math/generic/cosf.cpp
index d59304933d60d8..180a44e947eaff 100644
--- a/libc/src/math/generic/cosf.cpp
+++ b/libc/src/math/generic/cosf.cpp
@@ -42,7 +42,7 @@ static constexpr fputil::ExceptValues<float, N_EXCEPTS> COSF_EXCEPTS{{
LLVM_LIBC_FUNCTION(float, cosf, (float x)) {
using FPBits = typename fputil::FPBits<float>;
- using Sign = fputil::Sign;
+
FPBits xbits(x);
xbits.set_sign(Sign::POS);
diff --git a/libc/src/math/generic/coshf.cpp b/libc/src/math/generic/coshf.cpp
index a618056a64dc8a..a8ea324c950528 100644
--- a/libc/src/math/generic/coshf.cpp
+++ b/libc/src/math/generic/coshf.cpp
@@ -17,7 +17,7 @@ namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, coshf, (float x)) {
using FPBits = typename fputil::FPBits<float>;
- using Sign = fputil::Sign;
+
FPBits xbits(x);
xbits.set_sign(Sign::POS);
x = xbits.get_val();
diff --git a/libc/src/math/generic/exp.cpp b/libc/src/math/generic/exp.cpp
index 42a4491131a04e..3d060bcbd3be30 100644
--- a/libc/src/math/generic/exp.cpp
+++ b/libc/src/math/generic/exp.cpp
@@ -31,7 +31,7 @@ namespace LIBC_NAMESPACE {
using fputil::DoubleDouble;
using fputil::TripleDouble;
using Float128 = typename fputil::DyadicFloat<128>;
-using Sign = fputil::Sign;
+
using LIBC_NAMESPACE::operator""_u128;
// log2(e)
diff --git a/libc/src/math/generic/exp10.cpp b/libc/src/math/generic/exp10.cpp
index 72ece669765688..a4ae41407112bd 100644
--- a/libc/src/math/generic/exp10.cpp
+++ b/libc/src/math/generic/exp10.cpp
@@ -31,7 +31,7 @@ namespace LIBC_NAMESPACE {
using fputil::DoubleDouble;
using fputil::TripleDouble;
using Float128 = typename fputil::DyadicFloat<128>;
-using Sign = fputil::Sign;
+
using LIBC_NAMESPACE::operator""_u128;
// log2(10)
diff --git a/libc/src/math/generic/exp2.cpp b/libc/src/math/generic/exp2.cpp
index 83f545eb116bd3..1a2fa3feb83e54 100644
--- a/libc/src/math/generic/exp2.cpp
+++ b/libc/src/math/generic/exp2.cpp
@@ -31,7 +31,7 @@ namespace LIBC_NAMESPACE {
using fputil::DoubleDouble;
using fputil::TripleDouble;
using Float128 = typename fputil::DyadicFloat<128>;
-using Sign = fputil::Sign;
+
using LIBC_NAMESPACE::operator""_u128;
// Error bounds:
diff --git a/libc/src/math/generic/expm1.cpp b/libc/src/math/generic/expm1.cpp
index 9f14a8c2068ec1..574c4b9aaf39f7 100644
--- a/libc/src/math/generic/expm1.cpp
+++ b/libc/src/math/generic/expm1.cpp
@@ -39,7 +39,7 @@ namespace LIBC_NAMESPACE {
using fputil::DoubleDouble;
using fputil::TripleDouble;
using Float128 = typename fputil::DyadicFloat<128>;
-using Sign = fputil::Sign;
+
using LIBC_NAMESPACE::operator""_u128;
// log2(e)
@@ -276,7 +276,7 @@ double set_exceptional(double x) {
LLVM_LIBC_FUNCTION(double, expm1, (double x)) {
using FPBits = typename fputil::FPBits<double>;
- using Sign = fputil::Sign;
+
FPBits xbits(x);
bool x_is_neg = xbits.is_neg();
diff --git a/libc/src/math/generic/log.cpp b/libc/src/math/generic/log.cpp
index 339e0297560f79..6de0d90be80e11 100644
--- a/libc/src/math/generic/log.cpp
+++ b/libc/src/math/generic/log.cpp
@@ -24,7 +24,7 @@ namespace LIBC_NAMESPACE {
// 128-bit precision dyadic floating point numbers.
using Float128 = typename fputil::DyadicFloat<128>;
-using Sign = fputil::Sign;
+
using LIBC_NAMESPACE::operator""_u128;
namespace {
@@ -735,7 +735,7 @@ double log_accurate(int e_x, int index, double m_x) {
LLVM_LIBC_FUNCTION(double, log, (double x)) {
using FPBits_t = typename fputil::FPBits<double>;
- using Sign = fputil::Sign;
+
FPBits_t xbits(x);
uint64_t x_u = xbits.uintval();
diff --git a/libc/src/math/generic/log10.cpp b/libc/src/math/generic/log10.cpp
index c690ca28704075..fb839c111e6a0f 100644
--- a/libc/src/math/generic/log10.cpp
+++ b/libc/src/math/generic/log10.cpp
@@ -24,7 +24,7 @@ namespace LIBC_NAMESPACE {
// 128-bit precision dyadic floating point numbers.
using Float128 = typename fputil::DyadicFloat<128>;
-using Sign = fputil::Sign;
+
using LIBC_NAMESPACE::operator""_u128;
namespace {
@@ -737,7 +737,7 @@ double log10_accurate(int e_x, int index, double m_x) {
LLVM_LIBC_FUNCTION(double, log10, (double x)) {
using FPBits_t = typename fputil::FPBits<double>;
- using Sign = fputil::Sign;
+
FPBits_t xbits(x);
uint64_t x_u = xbits.uintval();
diff --git a/libc/src/math/generic/log10f.cpp b/libc/src/math/generic/log10f.cpp
index 0216bb2133f1bb..1b6979d4414a9e 100644
--- a/libc/src/math/generic/log10f.cpp
+++ b/libc/src/math/generic/log10f.cpp
@@ -106,7 +106,7 @@ LLVM_LIBC_FUNCTION(float, log10f, (float x)) {
constexpr double LOG10_2 = 0x1.34413509f79ffp-2;
using FPBits = typename fputil::FPBits<float>;
- using Sign = fputil::Sign;
+
FPBits xbits(x);
uint32_t x_u = xbits.uintval();
diff --git a/libc/src/math/generic/log1p.cpp b/libc/src/math/generic/log1p.cpp
index 26bb4d369278af..83bd753cde5da8 100644
--- a/libc/src/math/generic/log1p.cpp
+++ b/libc/src/math/generic/log1p.cpp
@@ -23,7 +23,7 @@ namespace LIBC_NAMESPACE {
// 128-bit precision dyadic floating point numbers.
using Float128 = typename fputil::DyadicFloat<128>;
-using Sign = fputil::Sign;
+
using LIBC_NAMESPACE::operator""_u128;
namespace {
@@ -877,7 +877,7 @@ LIBC_INLINE double log1p_accurate(int e_x, int index,
LLVM_LIBC_FUNCTION(double, log1p, (double x)) {
using FPBits_t = typename fputil::FPBits<double>;
- using Sign = fputil::Sign;
+
constexpr int EXP_BIAS = FPBits_t::EXP_BIAS;
constexpr int FRACTION_LEN = FPBits_t::FRACTION_LEN;
constexpr uint64_t FRACTION_MASK = FPBits_t::FRACTION_MASK;
diff --git a/libc/src/math/generic/log1pf.cpp b/libc/src/math/generic/log1pf.cpp
index 28426a88e64902..e3c7d95418b1fc 100644
--- a/libc/src/math/generic/log1pf.cpp
+++ b/libc/src/math/generic/log1pf.cpp
@@ -106,7 +106,7 @@ LLVM_LIBC_FUNCTION(float, log1pf, (float x)) {
case 0xbf800000U: // x = -1.0
fputil::set_errno_if_required(ERANGE);
fputil::raise_except_if_required(FE_DIVBYZERO);
- return FPBits::inf(fputil::Sign::NEG).get_val();
+ return FPBits::inf(Sign::NEG).get_val();
#ifndef LIBC_TARGET_CPU_HAS_FMA
case 0x4cc1c80bU: // x = 0x1.839016p+26f
return fputil::round_result_slightly_down(0x1.26fc04p+4f);
diff --git a/libc/src/math/generic/log2.cpp b/libc/src/math/generic/log2.cpp
index 648850b80b046e..c68bc60e8468bb 100644
--- a/libc/src/math/generic/log2.cpp
+++ b/libc/src/math/generic/log2.cpp
@@ -24,7 +24,7 @@ namespace LIBC_NAMESPACE {
// 128-bit precision dyadic floating point numbers.
using Float128 = typename fputil::DyadicFloat<128>;
-using Sign = fputil::Sign;
+
using LIBC_NAMESPACE::operator""_u128;
namespace {
@@ -857,7 +857,7 @@ double log2_accurate(int e_x, int index, double m_x) {
LLVM_LIBC_FUNCTION(double, log2, (double x)) {
using FPBits_t = typename fputil::FPBits<double>;
- using Sign = fputil::Sign;
+
FPBits_t xbits(x);
uint64_t x_u = xbits.uintval();
diff --git a/libc/src/math/generic/log2f.cpp b/libc/src/math/generic/log2f.cpp
index 8651316d282cab..c9f7b2121519df 100644
--- a/libc/src/math/generic/log2f.cpp
+++ b/libc/src/math/generic/log2f.cpp
@@ -55,7 +55,7 @@ namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, log2f, (float x)) {
using FPBits = typename fputil::FPBits<float>;
- using Sign = fputil::Sign;
+
FPBits xbits(x);
uint32_t x_u = xbits.uintval();
diff --git a/libc/src/math/generic/log_range_reduction.h b/libc/src/math/generic/log_range_reduction.h
index 8c9b7d2eabebef..64c0fc3aa4f539 100644
--- a/libc/src/math/generic/log_range_reduction.h
+++ b/libc/src/math/generic/log_range_reduction.h
@@ -37,7 +37,6 @@ log_range_reduction(double m_x, const LogRR &log_table,
fputil::DyadicFloat<128> &sum) {
using Float128 = typename fputil::DyadicFloat<128>;
using MType = typename Float128::MantissaType;
- using Sign = fputil::Sign;
int64_t v = static_cast<int64_t>(m_x * 0x1.0p60); // ulp = 2^-60
diff --git a/libc/src/math/generic/logf.cpp b/libc/src/math/generic/logf.cpp
index 49d258ecc13342..5296ba6bc13cf6 100644
--- a/libc/src/math/generic/logf.cpp
+++ b/libc/src/math/generic/logf.cpp
@@ -54,7 +54,7 @@ namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(float, logf, (float x)) {
constexpr double LOG_2 = 0x1.62e42fefa39efp-1;
using FPBits = typename fputil::FPBits<float>;
- using Sign = fputil::Sign;
+
FPBits xbits(x);
uint32_t x_u = xbits.uintval();
diff --git a/libc/src/math/generic/powf.cpp b/libc/src/math/generic/powf.cpp
index 2c666bab6d628f..0450ffd711fff1 100644
--- a/libc/src/math/generic/powf.cpp
+++ b/libc/src/math/generic/powf.cpp
@@ -424,7 +424,7 @@ LIBC_INLINE bool larger_exponent(double a, double b) {
double powf_double_double(int idx_x, double dx, double y6, double lo6_hi,
const DoubleDouble &exp2_hi_mid) {
using DoubleBits = typename fputil::FPBits<double>;
- using Sign = fputil::Sign;
+
// Perform a second range reduction step:
// idx2 = round(2^14 * (dx + 2^-8)) = round ( dx * 2^14 + 2^6)
// dx2 = (1 + dx) * r2 - 1
@@ -513,7 +513,7 @@ double powf_double_double(int idx_x, double dx, double y6, double lo6_hi,
LLVM_LIBC_FUNCTION(float, powf, (float x, float y)) {
using FloatBits = typename fputil::FPBits<float>;
using DoubleBits = typename fputil::FPBits<double>;
- using Sign = fputil::Sign;
+
FloatBits xbits(x), ybits(y);
uint32_t x_u = xbits.uintval();
diff --git a/libc/src/stdio/printf_core/float_dec_converter.h b/libc/src/stdio/printf_core/float_dec_converter.h
index 5270fc9de037ac..c4e8aaa2f0e2e9 100644
--- a/libc/src/stdio/printf_core/float_dec_converter.h
+++ b/libc/src/stdio/printf_core/float_dec_converter.h
@@ -48,7 +48,7 @@ constexpr uint32_t MAX_BLOCK = 999999999;
constexpr char DECIMAL_POINT = '.';
LIBC_INLINE RoundDirection get_round_direction(int last_digit, bool truncated,
- fputil::Sign sign) {
+ Sign sign) {
switch (fputil::quick_get_round()) {
case FE_TONEAREST:
// Round to nearest, if it's exactly halfway then round to even.
diff --git a/libc/test/UnitTest/FPMatcher.h b/libc/test/UnitTest/FPMatcher.h
index 43000efa09a39c..ee618a623efe19 100644
--- a/libc/test/UnitTest/FPMatcher.h
+++ b/libc/test/UnitTest/FPMatcher.h
@@ -63,7 +63,6 @@ template <TestCond C, typename T> FPMatcher<T, C> getMatcher(T expectedValue) {
template <typename T> struct FPTest : public Test {
using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>;
using StorageType = typename FPBits::StorageType;
- using Sign = LIBC_NAMESPACE::fputil::Sign;
static constexpr StorageType STORAGE_MAX =
LIBC_NAMESPACE::cpp::numeric_limits<StorageType>::max();
static constexpr T zero = FPBits::zero(Sign::POS).get_val();
@@ -92,7 +91,7 @@ template <typename T> struct FPTest : public Test {
#define DECLARE_SPECIAL_CONSTANTS(T) \
using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>; \
using StorageType = typename FPBits::StorageType; \
- using Sign = LIBC_NAMESPACE::fputil::Sign; \
+ \
static constexpr StorageType STORAGE_MAX = \
LIBC_NAMESPACE::cpp::numeric_limits<StorageType>::max(); \
const T zero = FPBits::zero(Sign::POS).get_val(); \
diff --git a/libc/test/src/__support/FPUtil/CMakeLists.txt b/libc/test/src/__support/FPUtil/CMakeLists.txt
index f1a027a514ba23..1cbeec0cc4eb08 100644
--- a/libc/test/src/__support/FPUtil/CMakeLists.txt
+++ b/libc/test/src/__support/FPUtil/CMakeLists.txt
@@ -24,6 +24,7 @@ add_libc_test(
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.fpbits_str
libc.src.__support.integer_literals
+ libc.src.__support.sign
)
add_fp_unittest(
diff --git a/libc/test/src/__support/FPUtil/dyadic_float_test.cpp b/libc/test/src/__support/FPUtil/dyadic_float_test.cpp
index 625aa70973b9f1..5ee9aaad563827 100644
--- a/libc/test/src/__support/FPUtil/dyadic_float_test.cpp
+++ b/libc/test/src/__support/FPUtil/dyadic_float_test.cpp
@@ -15,7 +15,6 @@
using Float128 = LIBC_NAMESPACE::fputil::DyadicFloat<128>;
using Float192 = LIBC_NAMESPACE::fputil::DyadicFloat<192>;
using Float256 = LIBC_NAMESPACE::fputil::DyadicFloat<256>;
-using Sign = LIBC_NAMESPACE::fputil::Sign;
TEST(LlvmLibcDyadicFloatTest, BasicConversions) {
Float128 x(Sign::POS, /*exponent*/ 0,
diff --git a/libc/test/src/__support/FPUtil/fpbits_test.cpp b/libc/test/src/__support/FPUtil/fpbits_test.cpp
index f5c27d4fc0302b..af20b1a0bdc7ef 100644
--- a/libc/test/src/__support/FPUtil/fpbits_tes...
[truncated]
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
lntue
approved these changes
Mar 20, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.