Skip to content

[libc] Fix compilation error on targets without 128-bit int types #97039

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 1 commit into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion libc/src/__support/high_precision_decimal.h
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,8 @@ class HighPrecisionDecimal {
result *= 10;
++cur_digit;
}
return result + this->should_round_up(this->decimal_point, round);
return result + static_cast<unsigned int>(
this->should_round_up(this->decimal_point, round));
}

// Extra functions for testing.
Expand Down
2 changes: 1 addition & 1 deletion libc/test/src/__support/math_extras_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ TYPED_TEST(LlvmLibcBitTest, CountZeros, UnsignedTypesNoBigInt) {
}

using UnsignedTypes = testing::TypeList<
#if defined(__SIZEOF_INT128__)
#if defined(LIBC_TYPES_HAS_INT128)
__uint128_t,
Comment on lines 104 to 106
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I caught this as I tried to reproduce what was happening on the failed Buildbot builds by just not defining LIBC_TYPES_HAS_INT128. It won't cause a compilation error on real builds where 128-bit int types are either really available or they're not. This is basically a cleanup.

#endif
unsigned char, unsigned short, unsigned int, unsigned long,
Expand Down
Loading