- if (comp > 0xff) {
- if (!complement) {
- Move(s, d, len, U8);
- d += len;
- }
- else {
- /* use the implicit 0x100..0x7fffffff search range */
- matches++;
- if (!del) {
- ch = (excess == -1) ? (I32)comp :
- ( excess == 0
- || excess < (IV)comp - 0xff) ? tbl[0x101]
- : tbl[comp+2];
- if ((UV)ch != pch) {
- d = uvchr_to_utf8(d, ch);
- pch = (UV)ch;
- }
- s += len;
- continue;
- }
- }
- }
- else if ((ch = tbl[comp]) >= 0) {
- matches++;
- if ((UV)ch != pch) {
- d = uvchr_to_utf8(d, ch);
- pch = (UV)ch;
- }
- s += len;
- continue;
- }
- else if (ch == -1) { /* -1 is unmapped character */
- Move(s, d, len, U8);
- d += len;
- }
- else if (ch == -2) /* -2 is delete character */
- matches++;
- s += len;
- pch = 0xfeedface;
- }
- }
- else {
- while (s < send) {
- STRLEN len;
- const UV comp = utf8n_to_uvchr(s, send - s, &len,
- UTF8_ALLOW_DEFAULT);
- I32 ch;
- if (comp > 0xff) {
- if (!complement) {
- Move(s, d, len, U8);
- d += len;
- }
- else {
- /* use the implicit 0x100..0x7fffffff search range */
- matches++;
- if (!del) {
- /* tr/...//c should call S_do_trans_count
- * instead */
- assert(excess != -1);
- ch = ( excess == 0
- || excess < (IV)comp - 0xff) ? tbl[0x101]
- : tbl[comp+2];
- d = uvchr_to_utf8(d, ch);
- }
- }
- }
- else if ((ch = tbl[comp]) >= 0) {
- d = uvchr_to_utf8(d, ch);
- matches++;
- }
- else if (ch == -1) { /* -1 is unmapped character */
- Move(s, d, len, U8);
- d += len;
- }
- else if (ch == -2) /* -2 is delete character */
- matches++;
- s += len;
- }
- }