[libc] Handle charNN_t in cpp::is_integral (#177463)
In C++20, char8_t is a distinct type from unsigned char, but is still an integral type. char16_t and char32_t are integral types in both C++17 and C++20. This also reverts the change in PR #177421, which is not needed when cpp::is_integral_v<char8_t> works correctly in all modes.
This commit is contained in:
parent
8a954feb3e
commit
476a194935
@ -26,13 +26,18 @@ private:
|
||||
}
|
||||
|
||||
public:
|
||||
LIBC_INLINE_VAR static constexpr bool value = __is_unqualified_any_of<
|
||||
T,
|
||||
LIBC_INLINE_VAR static constexpr bool value =
|
||||
__is_unqualified_any_of<T,
|
||||
#ifdef LIBC_TYPES_HAS_INT128
|
||||
__int128_t, __uint128_t,
|
||||
__int128_t, __uint128_t,
|
||||
#endif
|
||||
char, signed char, unsigned char, short, unsigned short, int,
|
||||
unsigned int, long, unsigned long, long long, unsigned long long, bool>();
|
||||
#ifdef __cpp_char8_t
|
||||
char8_t,
|
||||
#endif
|
||||
char16_t, char32_t, char, signed char,
|
||||
unsigned char, short, unsigned short, int,
|
||||
unsigned int, long, unsigned long, long long,
|
||||
unsigned long long, bool>();
|
||||
};
|
||||
template <typename T>
|
||||
LIBC_INLINE_VAR constexpr bool is_integral_v = is_integral<T>::value;
|
||||
|
||||
@ -77,8 +77,7 @@ LIBC_INLINE bool CharacterConverter::isValidState() {
|
||||
}
|
||||
|
||||
LIBC_INLINE int CharacterConverter::push(char8_t utf8_byte) {
|
||||
uint8_t num_ones =
|
||||
static_cast<uint8_t>(cpp::countl_one(static_cast<uint8_t>(utf8_byte)));
|
||||
uint8_t num_ones = static_cast<uint8_t>(cpp::countl_one(utf8_byte));
|
||||
// Checking the first byte if first push
|
||||
if (isEmpty()) {
|
||||
// UTF-8 char has 1 byte total
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user