This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Add code to compute edit distance (Damerau–Levenshtein)
[perl5.git] / utf8.c
diff --git a/utf8.c b/utf8.c
index fa1439b..2c2ef48 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -36,9 +36,9 @@
 static const char unees[] =
     "Malformed UTF-8 character (unexpected end of string)";
 static const char cp_above_legal_max[] =
   "It is deprecated to use code point 0x%"UVXf"; the permissible max is 0x%"UVXf"";
"Use of code point 0x%"UVXf" is deprecated; the permissible max is 0x%"UVXf"";
 
-#define MAX_NON_DEPRECATED_CP (IV_MAX)
+#define MAX_NON_DEPRECATED_CP ((UV) (IV_MAX))
 
 /*
 =head1 Unicode Support
@@ -141,9 +141,10 @@ Perl_uvoffuni_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags)
        *d++ = LATIN1_TO_NATIVE(uv);
        return d;
     }
+
     if (uv <= MAX_UTF8_TWO_BYTE) {
-        *d++ = UTF8_TWO_BYTE_HI(uv);
-        *d++ = UTF8_TWO_BYTE_LO(uv);
+        *d++ = I8_TO_NATIVE_UTF8(( uv >> SHIFT) | UTF_START_MARK(2));
+        *d++ = I8_TO_NATIVE_UTF8(( uv           & MASK) |   MARK);
         return d;
     }
 
@@ -1911,7 +1912,7 @@ Perl_to_utf8_case(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp,
 }
 
     /* change namve uv1 to 'from' */
-UV
+STATIC UV
 S__to_utf8_case(pTHX_ const UV uv1, const U8 *p, U8* ustrp, STRLEN *lenp,
                SV **swashp, const char *normal, const char *special)
 {