File tree Expand file tree Collapse file tree 3 files changed +6
-8
lines changed
src/__support/fixed_point Expand file tree Collapse file tree 3 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -185,9 +185,10 @@ countls(T f) {
185
185
using BitType = typename FXRep::StorageType;
186
186
using FXBits = FXBits<T>;
187
187
188
- if constexpr (FXRep::SIGN_LEN > 0 )
188
+ if constexpr (FXRep::SIGN_LEN > 0 ) {
189
189
if (f < 0 )
190
190
f = bit_not (f);
191
+ }
191
192
192
193
BitType value_bits = FXBits (f).get_bits ();
193
194
return cpp::countl_zero (value_bits) - FXRep::SIGN_LEN;
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ foreach(suffix IN ITEMS hr r lr hk k lk uhr ur ulr uhk uk ulk)
83
83
SRCS
84
84
countls${suffix}_test.cpp
85
85
COMPILE_OPTIONS
86
- -O3
86
+ ${libc_opt_high_flag}
87
87
DEPENDS
88
88
libc.src.stdfix.countls${suffix}
89
89
libc.src.__support.fixed_point.fx_rep
Original file line number Diff line number Diff line change @@ -36,21 +36,18 @@ template <typename T> class CountlsTest : public LIBC_NAMESPACE::testing::Test {
36
36
// bits according to ISO/IEC TR 18037.
37
37
EXPECT_EQ (is_signed ? 0 : FXRep::VALUE_LEN, func (min));
38
38
39
- if (10 <= static_cast <int >(max)) {
39
+ if (10 <= static_cast <int >(max))
40
40
EXPECT_EQ (FXRep::INTEGRAL_LEN - 4 , func (10 ));
41
- }
42
41
43
- if (static_cast <int >(min) <= -10 ) {
42
+ if (static_cast <int >(min) <= -10 )
44
43
EXPECT_EQ (FXRep::INTEGRAL_LEN - 4 , func (-10 ));
45
- }
46
44
47
45
if constexpr (is_signed) {
48
46
EXPECT_EQ (FXRep::VALUE_LEN, func (-zero));
49
47
EXPECT_EQ (FXRep::VALUE_LEN, func (-eps));
50
48
EXPECT_EQ (FXRep::INTEGRAL_LEN + 1 , func (-one_half));
51
- if (FXRep::FRACTION_LEN >= 2 ) {
49
+ if (FXRep::FRACTION_LEN >= 2 )
52
50
EXPECT_EQ (FXRep::INTEGRAL_LEN + 2 , func (-one_fourth));
53
- }
54
51
}
55
52
}
56
53
};
You can’t perform that action at this time.
0 commit comments