]> Cypherpunks repositories - gostls13.git/commit
unicode/utf16: add AppendRune
authorqmuntal <quimmuntal@gmail.com>
Fri, 27 May 2022 13:44:55 +0000 (15:44 +0200)
committerGopher Robot <gobot@golang.org>
Fri, 19 Aug 2022 16:45:08 +0000 (16:45 +0000)
commit48297f1fb15206cd13e0f31647e909292fb21975
treee4bea603653406bc6d5c289a69e29890e6017c4b
parentf65ded56263a9dd7d125f2b0001fb996df1fb3f3
unicode/utf16: add AppendRune

AppendRune appends the UTF-16 encoding of a rune to a []uint16.

    BenchmarkEncodeValidASCII-12                24.61ns 16B 1allocs
    BenchmarkEncodeValidJapaneseChars-12        18.79ns 8B  1allocs
    BenchmarkAppendRuneValidASCII-12            6.826ns 0B  0allocs
    BenchmarkAppendRuneValidJapaneseChars-12    3.547ns 0B  0allocs

The ASCII case is written to be inlineable.

Fixes #51896

Change-Id: I593b1029f603297ef6e80e036f2fee2a0938d38d
Reviewed-on: https://go-review.googlesource.com/c/go/+/409054
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Joedian Reid <joedian@golang.org>
api/next/51896.txt [new file with mode: 0644]
src/unicode/utf16/utf16.go
src/unicode/utf16/utf16_test.go