summaryrefslogtreecommitdiff
path: root/src/unicode
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2019-04-24 15:41:26 -0700
committerJosh Bleecher Snyder <josharian@gmail.com>2019-04-24 23:51:16 +0000
commit2be64d36456d6e2ad14476b6d09b9fc4e2ac591e (patch)
tree10dc11fcfa67d16bca4b23c87707ced2a3465f10 /src/unicode
parent57076b8e6edb6ee19b86ab349b8f7a85819e0085 (diff)
downloadgo-git-2be64d36456d6e2ad14476b6d09b9fc4e2ac591e.tar.gz
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>
Diffstat (limited to 'src/unicode')
-rw-r--r--src/unicode/utf8/utf8.go24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/unicode/utf8/utf8.go b/src/unicode/utf8/utf8.go
index b351cc351f..2d4a486256 100644
--- a/src/unicode/utf8/utf8.go
+++ b/src/unicode/utf8/utf8.go
@@ -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