Skip to content

Commit 2bf7920

Browse files
committed
fix: add cpp::min in LdExpTest.h
Signed-off-by: Krishna Pandey <[email protected]>
1 parent 49dc65d commit 2bf7920

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

libc/test/src/math/smoke/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2094,6 +2094,7 @@ add_fp_unittest(
20942094
LdExpTest.h
20952095
DEPENDS
20962096
libc.src.math.ldexp
2097+
libc.src.__support.CPP.algorithm
20972098
libc.src.__support.CPP.limits
20982099
libc.src.__support.FPUtil.fp_bits
20992100
libc.src.__support.FPUtil.normal_float
@@ -2109,6 +2110,7 @@ add_fp_unittest(
21092110
LdExpTest.h
21102111
DEPENDS
21112112
libc.src.math.ldexpf
2113+
libc.src.__support.CPP.algorithm
21122114
libc.src.__support.CPP.limits
21132115
libc.src.__support.FPUtil.fp_bits
21142116
libc.src.__support.FPUtil.normal_float
@@ -2124,6 +2126,7 @@ add_fp_unittest(
21242126
LdExpTest.h
21252127
DEPENDS
21262128
libc.src.math.ldexpl
2129+
libc.src.__support.CPP.algorithm
21272130
libc.src.__support.CPP.limits
21282131
libc.src.__support.FPUtil.fp_bits
21292132
libc.src.__support.FPUtil.normal_float
@@ -2139,6 +2142,7 @@ add_fp_unittest(
21392142
LdExpTest.h
21402143
DEPENDS
21412144
libc.src.math.ldexpf16
2145+
libc.src.__support.CPP.algorithm
21422146
libc.src.__support.CPP.limits
21432147
libc.src.__support.FPUtil.fp_bits
21442148
libc.src.__support.FPUtil.normal_float
@@ -2154,6 +2158,7 @@ add_fp_unittest(
21542158
LdExpTest.h
21552159
DEPENDS
21562160
libc.src.math.ldexpf128
2161+
libc.src.__support.CPP.algorithm
21572162
libc.src.__support.CPP.limits
21582163
libc.src.__support.FPUtil.fp_bits
21592164
libc.src.__support.FPUtil.normal_float
@@ -2169,6 +2174,7 @@ add_fp_unittest(
21692174
LdExpTest.h
21702175
DEPENDS
21712176
libc.src.math.ldexpbf16
2177+
libc.src.__support.CPP.algorithm
21722178
libc.src.__support.CPP.limits
21732179
libc.src.__support.FPUtil.bfloat16
21742180
libc.src.__support.FPUtil.fp_bits

libc/test/src/math/smoke/LdExpTest.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
#define LLVM_LIBC_TEST_SRC_MATH_LDEXPTEST_H
1111

1212
#include "hdr/stdint_proxy.h"
13-
#include "src/__support/CPP/limits.h" // INT_MAX
13+
#include "src/__support/CPP/algorithm.h" // cpp::min
14+
#include "src/__support/CPP/limits.h" // INT_MAX
1415
#include "src/__support/FPUtil/FPBits.h"
1516
#include "src/__support/FPUtil/NormalFloat.h"
1617
#include "test/UnitTest/FEnvSafeTest.h"
@@ -155,7 +156,8 @@ class LdExpTestTemplate : public LIBC_NAMESPACE::testing::FEnvSafeTest {
155156
// Start with a subnormal number but pass a very high number for exponent.
156157
// The result should not be infinity.
157158
x = NormalFloat(Sign::POS, -FPBits::EXP_BIAS + 1,
158-
NormalFloat::ONE >> FPBits::FRACTION_LEN);
159+
NormalFloat::ONE >>
160+
LIBC_NAMESPACE::cpp::min(FPBits::FRACTION_LEN, 10));
159161
exp = FPBits::MAX_BIASED_EXPONENT + 5;
160162
ASSERT_FALSE(FPBits(func(x, exp)).is_inf());
161163
// But if the exp is large enough to oversome than the normalization shift,

0 commit comments

Comments
 (0)