Skip to content

Commit 80d3a83

Browse files
author
Sriya Pratipati
committed
renamed variable and const -> constexpr
1 parent 077525a commit 80d3a83

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libc/src/__support/wchar/character_converter.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ int CharacterConverter::push(char8_t utf8_byte) {
3838
else if (numOnes >= 2 && numOnes <= 4) {
3939
/* Since the format is 110xxxxx, 1110xxxx, and 11110xxx for 2, 3, and 4,
4040
we will make the base mask with 7 ones and right shift it as necessary. */
41-
const size_t significant_bits = 7;
41+
constexpr size_t significant_bits = 7;
4242
state->total_bytes = numOnes;
4343
utf8_byte &=
4444
(mask_trailing_ones<uint32_t, significant_bits>() >> numOnes);
@@ -53,10 +53,10 @@ int CharacterConverter::push(char8_t utf8_byte) {
5353
}
5454
// Any subsequent push
5555
// Adding 6 more bits so need to left shift
56-
const size_t BITS_PER_UTF8 = 6;
56+
constexpr size_t ENCODED_BITS_PER_UTF8 = 6;
5757
if (cpp::countl_one(utf8_byte) == 1 && !isComplete()) {
58-
char32_t byte = utf8_byte & mask_trailing_ones<uint32_t, BITS_PER_UTF8>();
59-
state->partial = state->partial << BITS_PER_UTF8;
58+
char32_t byte = utf8_byte & mask_trailing_ones<uint32_t, ENCODED_BITS_PER_UTF8>();
59+
state->partial = state->partial << ENCODED_BITS_PER_UTF8;
6060
state->partial |= byte;
6161
state->bytes_processed++;
6262
return 0;

0 commit comments

Comments
 (0)