On 9 June 2010 07:55, Florian Weimer <fwei...@bfk.de> wrote:
> * Andrew John Hughes:
>
>> On 7 June 2010 23:04, Xueming Shen <xueming.s...@oracle.com> wrote:
>>> Hi Andrew,
>>>
>>> 6959197: When building with JAVAC_MAX_WARNINGS=true, the build fails in
>>> sun/nio/cs due to the use of -Werror
>>>
>>> (1)sun/io/ByteTocharISO2022JP.java
>>>   #129,  #151
>>>
>>>   if ((byte1 & (byte)0x80) != 0){
>>>
>>>       if ((byte2 & (byte)0x80) != 0){
>>>
>>>
>>> (byte) casting is not necessary as well?
>>>
>>
>> It's necessary.  0x80 is an integer literal
>> (http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.1)
>> which requires a lossy narrowing conversion to byte
>> (http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.3)
>
> Doesn't the & operator promote its arguments to int anyway?  I don't
> think the cast to byte makes a difference here because it does not
> matter if 0x80 is sign-extended or zero-extended.
>
> It might be more efficient to use "byte1 < 0" and "byte2 < 0" instead.
>

You're right.  I think I mentally read that as an assignment, not an
and operation.

If I'm reading it right now, it would seem to just be testing the sign
bit.  byte1 < 0 would be clearer if not faster, and I'd be for
changing that, though that probably should be a separate patch.

Sherman, does the new webrev look ok to push?

> --
> Florian Weimer                <fwei...@bfk.de>
> BFK edv-consulting GmbH       http://www.bfk.de/
> Kriegsstraße 100              tel: +49-721-96201-1
> D-76133 Karlsruhe             fax: +49-721-96201-99
>

Thanks,
-- 
Andrew :-)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net

PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint: F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8

Reply via email to