Peculiar fruits in the JDK

Ulf Zibis Ulf.Zibis at CoSoCo.de
Thu Jun 26 10:17:17 UTC 2008


Also I've found out, that MASK1 is superfluous, because on implicit 
converting from char to int all upper bits are automaticlly 0. 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));


Am 25.06.2008 10:57, Ulf Zibis schrieb:
> Hi David,
>
> can you show an example using a 'switch' statement which is shorter or 
> faster than:
>
>            char c = c2bMap.charAt(c2bMapIndex[(current & MASK1) >> 
> SHIFT] + (current & MASK2));
>
> or more faster for special mappings:
>
>            char c = (current < '\u0100') ? c2bMap.charAt(current) :
>                c2bMap.charAt(c2bMapIndex[(current & MASK1) >> SHIFT] + 
> (current & MASK2));
>
> Regards,
> Ulf
>




More information about the core-libs-dev mailing list