Progress of patches

Ulf Zibis Ulf.Zibis at gmx.de
Thu Mar 11 18:25:01 UTC 2010


Am 11.03.2010 05:42, schrieb Martin Buchholz:
> I couldn't resist making a similar change to isValidCodePoint.
>
> @@ -2678,7 +2678,8 @@
>        * @since  1.5
>        */
>       public static boolean isValidCodePoint(int codePoint) {
> -        return codePoint>= MIN_CODE_POINT&&  codePoint<= MAX_CODE_POINT;
> +        int plane = codePoint>>>  16;
> +        return plane<  ((MAX_CODE_POINT + 1)>>>  16);
>       }
>
>       /**
>
> This is a more important optimization, since isValidCodePoint
> almost always requires two compares, and this reduces it to one.
>    

Why isn't this true for isSupplementaryCodePoint() too ?
Particularly there the "cheap" compare against 0 can't be benefited.

> (Still, none of these are really important, and no one will notice)
>    

Maybe in String(int[] codePoints, int offset, int count) or in numerous 
sun.nio.cs charset coders which use these methods consecutive in loop on 
each unicode character.

-Ulf





More information about the core-libs-dev mailing list