Skip to content

Commit

Permalink
Merge pull request #59 from djoooooe/jh/fix-unicode-valid-codepoint
Browse files Browse the repository at this point in the history
Fix handling of negative values in UNICODE_VALID_CODEPOINT_P.
  • Loading branch information
headius authored Sep 22, 2022
2 parents d87794d + 0860897 commit c1e3097
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/org/jcodings/util/Macros.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down

0 comments on commit c1e3097

Please sign in to comment.