p4raw-id: //depot/perl@8827
if (SvUTF8(sv1)) {
char *pv = (char*)bytes_from_utf8((U8*)pv1, &cur1, &is_utf8);
- if (is_utf8)
- return 0;
- pv1tmp = (pv != pv1);
- pv1 = pv;
+
+ if ((pv1tmp = (pv != pv1)))
+ pv1 = pv;
}
else {
char *pv = (char *)bytes_from_utf8((U8*)pv2, &cur2, &is_utf8);
- if (is_utf8)
- return 0;
- pv2tmp = (pv != pv2);
- pv2 = pv;
+
+ if ((pv2tmp = (pv != pv2)))
+ pv2 = pv;
}
}
s = start; start = d;
while (s < send) {
U8 c = *s++;
+
if (UTF8_IS_ASCII(c))
*d++ = c;
else
- *d++ = UTF8_ACCUMULATE(c&3, *s++);
+ *d++ = UTF8_ACCUMULATE(c, *s++);
}
*d = '\0';
*len = d - start;
dst = d;
while (s < send) {
- if (*s < 0x80)
+ if (UTF8_IS_ASCII(*s))
*d++ = *s++;
else {
UV uv = *s++;
- *d++ = (( uv >> 6) | 0xc0);
- *d++ = (( uv & 0x3f) | 0x80);
+
+ *d++ = UTF8_EIGHT_BIT_HI(uv);
+ *d++ = UTF8_EIGHT_BIT_LO(uv);
}
}
*d = '\0';