classpath
[Top][All Lists]
Advanced

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

Re: small patches for BigInteger, BigDecimal, Double


From: J. Russell Smyth
Subject: Re: small patches for BigInteger, BigDecimal, Double
Date: Wed, 25 Apr 2001 21:09:50 -0700

This is better, and I will make it so when I submit my patch!

Russell


> On Wed, 25 Apr 2001, J. Russell Smyth wrote:
> > gnu/java/io/decode/DecoderEightBitLookup.javav - convertToChar wouldnt
> > work with ascii values above 128 due to byte-char conversion
> >
> > public char[]
> > convertToChars(byte[] buf, int buf_offset, int len, char[] cbuf,
> >                int cbuf_offset)
> > {
> >
> >   for (int i = 0; i < len; i++){
> > -   cbuf[cbuf_offset + i] = lookup_table[buf[buf_offset + i]];
> > +   cbuf[cbuf_offset + i]
> > =lookup_table[buf[buf_offset+i]<0?256+buf[buf_offset+i]:buf[buf_offset+i]];
>
> Why don't you write:
>
> cbuf[cbuf_offset + i] = lookup_table[buf[buf_offset+i] & 0xff];
>
> I think this is clearer and faster.
>
> >   }
> >
> >   return(cbuf);
> > }
>
> Best,
>   Erwin Bolwidt




reply via email to

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