@@ -1275,6 +1275,23 @@ Perl_valid_utf8_to_uvchr(const U8 *s, STRLEN *retlen)
1275
1275
1276
1276
}
1277
1277
1278
+ /* This looks like 0x010101... */
1279
+ # define PERL_COUNT_MULTIPLIER (~ (UINTMAX_C(0)) / 0xFF)
1280
+
1281
+ /* This looks like 0x808080... */
1282
+ # define PERL_VARIANTS_WORD_MASK (PERL_COUNT_MULTIPLIER * 0x80)
1283
+ # define PERL_WORDSIZE sizeof(PERL_UINTMAX_T)
1284
+ # define PERL_WORD_BOUNDARY_MASK (PERL_WORDSIZE - 1)
1285
+
1286
+ /* Evaluates to 0 if 'x' is at a word boundary; otherwise evaluates to 1, by
1287
+ * or'ing together the lowest bits of 'x'. Hopefully the final term gets
1288
+ * optimized out completely on a 32-bit system, and its mask gets optimized out
1289
+ * on a 64-bit system */
1290
+ # define PERL_IS_SUBWORD_ADDR (x ) (1 & ( PTR2nat(x) \
1291
+ | ( PTR2nat(x) >> 1) \
1292
+ | ( ( (PTR2nat(x) \
1293
+ & PERL_WORD_BOUNDARY_MASK) >> 2))))
1294
+
1278
1295
/*
1279
1296
=for apidoc is_utf8_invariant_string
1280
1297
=for apidoc_item is_utf8_invariant_string_loc
@@ -1333,23 +1350,6 @@ Perl_is_utf8_invariant_string_loc(const U8* const s, STRLEN len, const U8 ** ep)
1333
1350
1334
1351
send = s + len ;
1335
1352
1336
- /* This looks like 0x010101... */
1337
- # define PERL_COUNT_MULTIPLIER (~ (UINTMAX_C(0)) / 0xFF)
1338
-
1339
- /* This looks like 0x808080... */
1340
- # define PERL_VARIANTS_WORD_MASK (PERL_COUNT_MULTIPLIER * 0x80)
1341
- # define PERL_WORDSIZE sizeof(PERL_UINTMAX_T)
1342
- # define PERL_WORD_BOUNDARY_MASK (PERL_WORDSIZE - 1)
1343
-
1344
- /* Evaluates to 0 if 'x' is at a word boundary; otherwise evaluates to 1, by
1345
- * or'ing together the lowest bits of 'x'. Hopefully the final term gets
1346
- * optimized out completely on a 32-bit system, and its mask gets optimized out
1347
- * on a 64-bit system */
1348
- # define PERL_IS_SUBWORD_ADDR (x ) (1 & ( PTR2nat(x) \
1349
- | ( PTR2nat(x) >> 1) \
1350
- | ( ( (PTR2nat(x) \
1351
- & PERL_WORD_BOUNDARY_MASK) >> 2))))
1352
-
1353
1353
#ifndef EBCDIC
1354
1354
1355
1355
/* Do the word-at-a-time iff there is at least one usable full word. That
0 commit comments