review request for 6798511/6860431: Include functionality of Surrogate in Character

Martin Buchholz martinrb at google.com
Wed Mar 17 15:46:42 UTC 2010


On Wed, Mar 17, 2010 at 01:11, Ulf Zibis <Ulf.Zibis at gmx.de> wrote:
> Am I mad ???
>
> 2nd. correction:
>
> But
>        for (int i = offset; i < offset + count; i++) {
>            int c = codePoints[i];
>            char plane = (char)(c >>> 16);
>            if (plane == 0)
>                n += 1;
>            else if (plane < 0x11)
>                n += 2;
>            else throw new IllegalArgumentException(Integer.toString(c));
>        }
> has too only 2 branches and additionally could benefit from tiny 16-bit
> comparisons.
> The shift additionally could be omitted on CPU's which can benefit from
> 6933327.

I'm not a x86 or hotspot expert, but I would think that the "plane"
variable is never written to memory, but lives only in a register,
so I see only drawbacks to making plane a "char".

Martin



More information about the core-libs-dev mailing list