修正 runtime 的 utf8 相关常量定义位置错误

This commit is contained in:
3dgen 2023-08-30 22:05:31 +08:00
parent 33f6724e76
commit 53f9d895c8
2 changed files with 16 additions and 16 deletions

View File

@ -204,6 +204,22 @@ func next_rune(iter: stringIter) => (ok: bool, k: int, v: rune, pos: int) {
return
}
const (
MaxRune = '\U0010FFFF'
RuneError = '\uFFFD'
surrogateMin = 0xD800
surrogateMax = 0xDFFF
tx = 0b10000000
t2 = 0b11000000
t3 = 0b11100000
t4 = 0b11110000
maskx = 0b00111111
rune1Max = 1<<7 - 1
rune2Max = 1<<11 - 1
rune3Max = 1<<16 - 1
)
func stringFromRune(r: rune) => string {
p := make([]byte, 0, 4)
n: i32

View File

@ -114,22 +114,6 @@ func waPrintString(s: string) {
printString(s)
}
const (
MaxRune = '\U0010FFFF'
RuneError = '\uFFFD'
surrogateMin = 0xD800
surrogateMax = 0xDFFF
tx = 0b10000000
t2 = 0b11000000
t3 = 0b11100000
t4 = 0b11110000
maskx = 0b00111111
rune1Max = 1<<7 - 1
rune2Max = 1<<11 - 1
rune3Max = 1<<16 - 1
)
#wa:linkname $runtime.waPrintRune
func waPrintRune(r: i32) {
printString(stringFromRune(r))