Peculiar fruits in the JDK

Rémi Forax forax at univ-mlv.fr
Thu Jun 26 18:58:40 UTC 2008


Ulf Zibis a écrit :
> char's ARE ALWAYS unsigned. :-)
my apologies :)
ok, read a mail twice before hitting the reply button :)

Rémi
>
>
> 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