Peculiar fruits in the JDK

Rémi Forax forax at univ-mlv.fr
Thu Jun 26 10:31:46 UTC 2008


Ulf Zibis a écrit :
> Also I've found out, that MASK1 is superfluous, because on implicit 
> converting from char to int all upper bits are automaticlly 0. 
No, all upper bits are the value of the sign bit, you can remove the 
mask only if
you use unsigned values.
> So we can code instead:
>
>           char c = c2bMap.charAt(c2bMapIndex[current >> SHIFT] + 
> (current & MASK));
>
>           char c = (current < '\u0100') ? c2bMap.charAt(current) :
>               c2bMap.charAt(c2bMapIndex[current >> SHIFT] + (current & 
> MASK));
Rémi



More information about the core-libs-dev mailing list