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-16conversion


From: Chris Burdess
Subject: Re: [cp-patches] RFC: patch for Unicode scalar value to UTF-16conversion
Date: Sun, 8 Jan 2006 10:45:15 +0000
User-agent: Mutt/1.5.10i

Jeroen Frijters wrote:
> > > I think it is better to use the named constants instead of 
> > the values.
> > 
> > Fair enough, but what about the casting: doesn't that make it 
> > less efficient?
> 
> No, it's a no-op (and not even needed in the source).

OK

> > > I also have a mild preference for the bit-shifting and masking
> > > computation, but this is more minor.
> > 
> > The problem is that the bit-shifting method produces the wrong result.
> 
> In this case they both produce the same result. I think the problem was
> that the original code forgot to subtract 0x10000.

I see. So, is there a good reason to do it this way (bitshifting and
bitmasking) rather than the arithmetical methods (which presumably get
compiled to the same thing, but are much more straightforward to
understand)?

Here is an updated patch that includes the corresponding conversion back
to a Unicode scalar (the original code also forgot to add 0x10000).

Should I commit this? Or should it be bitshifting and bitmasking?
-- 
Chris Burdess
  "They that can give up essential liberty to obtain a little safety
  deserve neither liberty nor safety." - Benjamin Franklin

Attachment: patch
Description: Text document

Attachment: pgpCNQEGZcTlp.pgp
Description: PGP signature


reply via email to

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