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: Erwin Bolwidt
Subject: Re: small patches for BigInteger, BigDecimal, Double
Date: Wed, 25 Apr 2001 15:04:19 +0200 (CEST)

I don't know enough about these sources to comment on the patches, except
this small thing.

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]