Peculiar fruits in the JDK

Ulf Zibis Ulf.Zibis at CoSoCo.de
Thu Jun 26 16:26:57 UTC 2008


char's ARE ALWAYS unsigned. :-)


Am 26.06.2008 12:31, Rémi Forax schrieb:
> 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