Skip to content

Commit

Permalink
cases: add bit for exception index
Browse files Browse the repository at this point in the history
The limit for this will be reached by Unicode 11.

Updates golang/go#27945

Change-Id: I5add868e60ba632de61b1ff3cb520453759b95c4
Reviewed-on: https://go-review.googlesource.com/c/text/+/169639
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
  • Loading branch information
mpvl committed Apr 24, 2019
1 parent c40a8cc commit 009a891
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 94 deletions.
2 changes: 1 addition & 1 deletion cases/gen.go
Expand Up @@ -335,7 +335,7 @@ func makeException(ri *runeInfo) {
ri.entry |= exceptionBit

if len(exceptionData) >= 1<<numExceptionBits {
log.Fatalf("%U:exceptionData too large %x > %d bits", ri.Rune, len(exceptionData), numExceptionBits)
log.Fatalf("%U:exceptionData too large %#x > %d bits", ri.Rune, len(exceptionData), numExceptionBits)
}

// Set the offset in the exceptionData array.
Expand Down
7 changes: 3 additions & 4 deletions cases/gen_trieval.go
Expand Up @@ -19,8 +19,7 @@ package main
// The per-rune values have the following format:
//
// if (exception) {
// 15..5 unsigned exception index
// 4 unused
// 15..4 unsigned exception index
// } else {
// 15..8 XOR pattern or index to XOR pattern for case mapping
// Only 13..8 are used for XOR patterns.
Expand Down Expand Up @@ -52,8 +51,8 @@ const (
isMidBit = 1 << 6

exceptionBit = 1 << 3
exceptionShift = 5
numExceptionBits = 11
exceptionShift = 4
numExceptionBits = 12

xorIndexBit = 1 << 6
xorShift = 8
Expand Down

0 comments on commit 009a891

Please sign in to comment.