[security-dev 00464]: Re: hg: jdk7/tl/jdk: 6642323: Speeding up Single Byte Decoders; ...

Ulf Zibis Ulf.Zibis at gmx.de
Mon Dec 15 12:56:21 PST 2008


Maybe little faster, especially for short strings:

       private CoderResult decodeArrayLoop(ByteBuffer src, CharBuffer 
dst) {
           byte[] sa = src.array();
           int sp = src.arrayOffset() + src.position();
           int sr = src.remaining();  // faster than ... 
src.arrayOffset() + src.limit()

           char[] da = dst.array();
           int dp = dst.arrayOffset() + dst.position();
           int dr = dst.remaining(); // dl is never used

           for (int sl = sp + (sr <= dr ? sr : dr); sp < sl; sp++, dp++)
               if ((da[dp] = decode(sa[sp])) == UNMAPPABLE_DECODING)
                   return withResult(CoderResult.unmappableForLength(1), 
src, sp, dst, dp);
           return withResult(sr <= dr ? CoderResult.UNDERFLOW : 
CoderResult.OVERFLOW, src, sp, dst, dp);
       }

Regards,
Ulf


Am 10.12.2008 23:10, xueming.shen at sun.com schrieb:
> Changeset: b89ba9a6d9a6
> Author:    sherman
> Date:      2008-12-10 14:03 -0800
> URL:       http://hg.openjdk.java.net/jdk7/tl/jdk/rev/b89ba9a6d9a6
>
> 6642323: Speeding up Single Byte Decoders
> 6642328: Speeding up Single Byte Encoders
> Summary: re-implementation of mapping based sbcs charts
> Reviewed-by: alanb
>
>   




More information about the security-dev mailing list