Skip to content

Commit 2da28ff

Browse files
committed
Remove C-style casts in FxBitsTest.h
1 parent fd76b63 commit 2da28ff

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

libc/test/src/stdfix/FxBitsTest.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ class FxBitsTest : public LIBC_NAMESPACE::testing::Test {
2424
static constexpr T eps = FXRep::EPS();
2525
constexpr XType get_one_or_saturated_fraction() {
2626
if (FXRep::INTEGRAL_LEN > 0) {
27-
return (XType)((XType)0x1 << FXRep::FRACTION_LEN);
27+
return static_cast<XType>(static_cast<XType>(0x1) << FXRep::FRACTION_LEN);
2828
} else {
29-
return (
30-
XType)LIBC_NAMESPACE::mask_trailing_ones<typename FXRep::StorageType,
31-
FXRep::FRACTION_LEN>();
29+
return static_cast<XType>(
30+
LIBC_NAMESPACE::mask_trailing_ones<typename FXRep::StorageType,
31+
FXRep::FRACTION_LEN>());
3232
}
3333
}
3434

@@ -38,7 +38,8 @@ class FxBitsTest : public LIBC_NAMESPACE::testing::Test {
3838
void test_special_numbers(FxBitsFunc func) {
3939
EXPECT_EQ(zero, func(0));
4040
EXPECT_EQ(eps, func(0x1));
41-
EXPECT_EQ(half, func((XType)0x1 << (FXRep::FRACTION_LEN - 1)));
41+
// x.1000...
42+
EXPECT_EQ(half, func(static_cast<XType>(0x1) << (FXRep::FRACTION_LEN - 1)));
4243
// Occupy the bit to the left of the fixed point for Accum types
4344
// Saturate fraction portion for Fract types
4445
EXPECT_EQ(one, func(get_one_or_saturated_fraction()));

0 commit comments

Comments
 (0)