aboutsummaryrefslogtreecommitdiff
path: root/posix
diff options
context:
space:
mode:
Diffstat (limited to 'posix')
-rw-r--r--posix/regcomp.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/posix/regcomp.c b/posix/regcomp.c
index 871ae2f..520596b 100644
--- a/posix/regcomp.c
+++ b/posix/regcomp.c
@@ -925,26 +925,26 @@ init_word_char (re_dfa_t *dfa)
int ch = 0;
if (BE (dfa->map_notascii == 0, 1))
{
- if (sizeof (dfa->word_char[0]) == 8)
- {
- /* The extra temporaries here avoid "implicitly truncated"
- warnings in the case when this is dead code, i.e. 32-bit. */
- const uint64_t wc0 = UINT64_C (0x03ff000000000000);
- const uint64_t wc1 = UINT64_C (0x07fffffe87fffffe);
- dfa->word_char[0] = wc0;
- dfa->word_char[1] = wc1;
+ bitset_word_t bits0 = 0x00000000;
+ bitset_word_t bits1 = 0x03ff0000;
+ bitset_word_t bits2 = 0x87fffffe;
+ bitset_word_t bits3 = 0x07fffffe;
+ if (BITSET_WORD_BITS == 64)
+ {
+ dfa->word_char[0] = bits1 << 31 << 1 | bits0;
+ dfa->word_char[1] = bits3 << 31 << 1 | bits2;
i = 2;
}
- else if (sizeof (dfa->word_char[0]) == 4)
+ else if (BITSET_WORD_BITS == 32)
{
- dfa->word_char[0] = UINT32_C (0x00000000);
- dfa->word_char[1] = UINT32_C (0x03ff0000);
- dfa->word_char[2] = UINT32_C (0x87fffffe);
- dfa->word_char[3] = UINT32_C (0x07fffffe);
+ dfa->word_char[0] = bits0;
+ dfa->word_char[1] = bits1;
+ dfa->word_char[2] = bits2;
+ dfa->word_char[3] = bits3;
i = 4;
}
else
- abort ();
+ goto general_case;
ch = 128;
if (BE (dfa->is_utf8, 1))
@@ -954,6 +954,7 @@ init_word_char (re_dfa_t *dfa)
}
}
+ general_case:
for (; i < BITSET_WORDS; ++i)
for (int j = 0; j < BITSET_WORD_BITS; ++j, ++ch)
if (isalnum (ch) || ch == '_')