classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] RFC: patch for Unicode scalar value to UTF-16 conversio


From: Tom Tromey
Subject: Re: [cp-patches] RFC: patch for Unicode scalar value to UTF-16 conversion
Date: 07 Jan 2006 16:01:17 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

>>>>> "Chris" == Chris Burdess <address@hidden> writes:

Chris> Please comment.

Chris> -        dst[dstIndex + 1] = (char) ((codePoint & 0x3ff)
Chris> -                                    + (int) MIN_LOW_SURROGATE );
Chris> -        dst[dstIndex] = (char) ((codePoint >> 10) + (int) 
MIN_HIGH_SURROGATE);
Chris> +        dst[dstIndex + 1] = (char) (((codePoint - 0x10000) % 0x400) + 
0xdc00);
Chris> +        dst[dstIndex] = (char) (((codePoint - 0x10000) / 0x400) + 
0xd800);

I think it is better to use the named constants instead of the values.

I also have a mild preference for the bit-shifting and masking
computation, but this is more minor.

Tom




reply via email to

[Prev in Thread] Current Thread [Next in Thread]