Permalink
Browse files

maybe drop: avoid ifs

  • Loading branch information...
khwilliamson committed Dec 5, 2017
1 parent b4615ce commit a8f13f4886b7842d51cb5cecdfb90ef5e45a1f95
Showing with 7 additions and 15 deletions.
  1. +1 −5 inline.h
  2. +1 −1 locale.c
  3. +1 −2 op.c
  4. +1 −2 sv.c
  5. +3 −5 toke.c
View
@@ -527,11 +527,7 @@ S_variant_under_utf8_count(const U8* const s, const U8* const e)
/* Process per-byte */
while (x < e) {
if (! UTF8_IS_INVARIANT(*x)) {
count++;
}
x++;
count += ! UTF8_IS_INVARIANT(*x++);
}
return count;
View
@@ -2425,7 +2425,7 @@ Perl__mem_collxfrm(pTHX_ const char *input_string,
} /* End of determining the character that is to replace NULs */
/* If the replacement is variant under UTF-8, it must match the
* UTF8-ness as the original */
* UTF8-ness of the original */
if ( ! UVCHR_IS_INVARIANT(PL_strxfrm_NUL_replacement) && utf8) {
this_replacement_char[0] =
UTF8_EIGHT_BIT_HI(PL_strxfrm_NUL_replacement);
View
3 op.c
@@ -2558,8 +2558,7 @@ S_sprintf_is_multiconcatable(pTHX_ OP *o,struct sprintf_ismc_info *info)
for (p = s; p < e; p++) {
if (*p != '%') {
total_len++;
if (!UTF8_IS_INVARIANT(*p))
variant++;
variant += ! UTF8_IS_INVARIANT(*p);
continue;
}
p++;
View
3 sv.c
@@ -11944,8 +11944,7 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p
STRLEN need = SvCUR(sv) + (q - fmtstart) + 1;
for (p = fmtstart; p < q; p++)
if (!NATIVE_BYTE_IS_INVARIANT(*p))
need++;
need += ! NATIVE_BYTE_IS_INVARIANT(*p);
SvGROW(sv, need);
dst = SvEND(sv);
View
8 toke.c
@@ -3070,8 +3070,8 @@ S_scan_const(pTHX_ char *start)
* get it out of the way now.) */
if (UNLIKELY(range_max == range_min)) {
d = max_ptr;
if (! has_utf8 && ! UVCHR_IS_INVARIANT(range_max)) {
utf8_variant_count--;
if (! has_utf8) {
utf8_variant_count -= ! UVCHR_IS_INVARIANT(range_max);
}
goto range_done;
}
@@ -3302,9 +3302,7 @@ S_scan_const(pTHX_ char *start)
#ifdef EBCDIC
/* In this case on EBCDIC, we haven't calculated
* the variants. Do it here, as we go along */
if (! UVCHR_IS_INVARIANT(i)) {
utf8_variant_count++;
}
utf8_variant_count += ! UVCHR_IS_INVARIANT(i);
#endif
*d++ = (char)i;
}

0 comments on commit a8f13f4

Please sign in to comment.