Rewrite of IBM doublebyte charsets (original) (raw)
Ulf Zibis Ulf.Zibis at gmx.de
Thu May 14 20:26:11 UTC 2009
- Previous message: Rewrite of EUC_TW
- Next message: Rewrite of IBM doublebyte charsets
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Am 12.05.2009 20:31, Xueming Shen schrieb:
Ulf Zibis wrote:
Sherman, thanks for verifying my suggestions.
> (1) simplify the "plane number" byte check by adding a new static array of cnspToIndex[16] for decoder or simply: static final byte[] cnspToIndex = new byte[0x100]; static { Arrays.fill(cnspToIndex, -1); cnspToIndex[0xa2] = 1; cnspToIndex[0xa3] = 2; cnspToIndex[0xa4] = 3; cnspToIndex[0xa5] = 4; cnspToIndex[0xa6] = 5; cnspToIndex[0xa7] = 6; cnspToIndex[0xaf] = 7; } if ((cnsPlane = cnspToIndex[sa[sp + 1] && 0xff]) < 0) return CoderResult.malformedForLength(2); considered that, but ended up thinking it might not really worth the 0x100 bytes:-) at least based on my measurement.
But I wonder, that you don't consider my XOR approach. The XOR needs only to be computed once in contrast to 3 times computing AND + comparing against -1 (needs load operation in contrast to compare '< 0')
-Ulf
- Previous message: Rewrite of EUC_TW
- Next message: Rewrite of IBM doublebyte charsets
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]