add --keep-dist

This commit is contained in:
Mikaël Cluseau
2026-07-17 11:33:07 +02:00
parent 8d56e5c436
commit e58e8f758e
4 changed files with 17 additions and 11 deletions
+6 -6
View File
@@ -2,23 +2,23 @@ package utf16
import (
"encoding/binary"
"fmt"
"fmt"
"unicode/utf8"
)
func FromUTF8(data []byte) (res []byte) {
endian := binary.LittleEndian
endian := binary.LittleEndian
res = make([]byte, (len(data)+1)*2)
res = res[:2]
endian.PutUint16(res, 0xfeff)
res = res[:2]
endian.PutUint16(res, 0xfeff)
for len(data) > 0 {
r, size := utf8.DecodeRune(data)
if r > 65535 {
panic(fmt.Errorf("r=0x%x > 0xffff", r))
}
panic(fmt.Errorf("r=0x%x > 0xffff", r))
}
slen := len(res)
res = res[:slen+2]