mirror of
https://github.com/netwide-assembler/nasm.git
synced 2024-11-27 08:10:07 +08:00
asm/quote.c: fix range cutoffs for UTF-8
The various UTF-8 byte cutoffs were off by a factor of 2. Fix. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
8eb1c3270a
commit
d4b20355d2
10
asm/quote.c
10
asm/quote.c
@ -197,31 +197,31 @@ static unsigned char *emit_utf8(unsigned char *q, uint32_t v)
|
||||
}
|
||||
|
||||
vb1 = v >> 6;
|
||||
if (vb1 <= 0x3f) {
|
||||
if (vb1 <= 0x1f) {
|
||||
*q++ = 0xc0 + vb1;
|
||||
goto out1;
|
||||
}
|
||||
|
||||
vb2 = vb1 >> 6;
|
||||
if (vb2 <= 0x1f) {
|
||||
if (vb2 <= 0x0f) {
|
||||
*q++ = 0xe0 + vb2;
|
||||
goto out2;
|
||||
}
|
||||
|
||||
vb3 = vb2 >> 6;
|
||||
if (vb3 <= 0x0f) {
|
||||
if (vb3 <= 0x07) {
|
||||
*q++ = 0xf0 + vb3;
|
||||
goto out3;
|
||||
}
|
||||
|
||||
vb4 = vb3 >> 6;
|
||||
if (vb4 <= 0x07) {
|
||||
if (vb4 <= 0x03) {
|
||||
*q++ = 0xf8 + vb4;
|
||||
goto out4;
|
||||
}
|
||||
|
||||
vb5 = vb4 >> 6;
|
||||
if (vb5 <= 0x03) {
|
||||
if (vb5 <= 0x01) {
|
||||
*q++ = 0xfc + vb5;
|
||||
goto out5;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user