diff --git a/src/org/jcodings/util/Macros.java b/src/org/jcodings/util/Macros.java index c8ed091..829c208 100644 --- a/src/org/jcodings/util/Macros.java +++ b/src/org/jcodings/util/Macros.java @@ -48,7 +48,7 @@ public static int CONSTRUCT_MBCLEN_CHARFOUND(int n) { // UNICODE_VALID_CODEPOINT_P public static boolean UNICODE_VALID_CODEPOINT_P(int c) { - return ((c) <= 0x10ffff) && + return (Integer.compareUnsigned(c, 0x10ffff) <= 0) && !((c) < 0x10000 && UTF16_IS_SURROGATE((c) >> 8)); }