mirror of https://github.com/golang/go.git
unicode/utf8: use binary literals
We were using hex literals and had the binary literal in a comment. When I was working with this code, I always referred to the comment. That's an indicator that we should just use the binary literal directly. Updates #19308 Change-Id: I2279cb8efb4ae5f2e1558c15979058ab09eb4f6f Reviewed-on: https://go-review.googlesource.com/c/go/+/173663 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
57076b8e6e
commit
2be64d3645
|
|
@ -25,25 +25,25 @@ const (
|
|||
)
|
||||
|
||||
const (
|
||||
t1 = 0x00 // 0000 0000
|
||||
tx = 0x80 // 1000 0000
|
||||
t2 = 0xC0 // 1100 0000
|
||||
t3 = 0xE0 // 1110 0000
|
||||
t4 = 0xF0 // 1111 0000
|
||||
t5 = 0xF8 // 1111 1000
|
||||
t1 = 0b00000000
|
||||
tx = 0b10000000
|
||||
t2 = 0b11000000
|
||||
t3 = 0b11100000
|
||||
t4 = 0b11110000
|
||||
t5 = 0b11111000
|
||||
|
||||
maskx = 0x3F // 0011 1111
|
||||
mask2 = 0x1F // 0001 1111
|
||||
mask3 = 0x0F // 0000 1111
|
||||
mask4 = 0x07 // 0000 0111
|
||||
maskx = 0b00111111
|
||||
mask2 = 0b00011111
|
||||
mask3 = 0b00001111
|
||||
mask4 = 0b00000111
|
||||
|
||||
rune1Max = 1<<7 - 1
|
||||
rune2Max = 1<<11 - 1
|
||||
rune3Max = 1<<16 - 1
|
||||
|
||||
// The default lowest and highest continuation byte.
|
||||
locb = 0x80 // 1000 0000
|
||||
hicb = 0xBF // 1011 1111
|
||||
locb = 0b10000000
|
||||
hicb = 0b10111111
|
||||
|
||||
// These names of these constants are chosen to give nice alignment in the
|
||||
// table below. The first nibble is an index into acceptRanges or F for
|
||||
|
|
|
|||
Loading…
Reference in New Issue