On Wed, Mar 17, 2010 at 01:11, Ulf Zibis <[email protected]> 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
