byte
byte copied to clipboard
refactor: improve CESU-8 encoding coding style
BTW: js CESU-8 encoding is faster then Buffer UTF-8 encoding
putRawStringSmallLessThan0x80*10000: 672.642ms
putRawStringSmallLessThan0x800*10000: 592.960ms
putRawStringSmallBiggerThan0x800*10000: 861.010ms
putUTF8RawStringSmallLessThan0x80*10000: 841.638ms
putUTF8RawStringSmallLessThan0x800*10000: 958.383ms
putUTF8RawStringSmallBiggerThan0x800*10000: 1793.470ms
@fengmk2, thanks for your PR! By analyzing the history of the files in this pull request, we identified @gxcsoccer, @dead-horse and @pmq20 to be potential reviewers.
然而还要看是否有溢出的情况,我看看 (0xc0 + ((ch >> 6) & 0x1f)) 和 (0x80 + (ch & 0x3f)) 的取值范围
ch 的最大值是 65536,因此(0xc0 + ((ch >> 6) & 0x1f)) 和 (0x80 + (ch & 0x3f)) 的最大值分别是 192 和 128,不会超出 4294967296 因此不需要 >>> 32。确实没问题