Skip to content

Commit 009a891

Browse files
committed
cases: add bit for exception index
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Russ Cox <[email protected]>
1 parent c40a8cc commit 009a891

File tree

4 files changed

+92
-94
lines changed

4 files changed

+92
-94
lines changed

cases/gen.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ func makeException(ri *runeInfo) {
335335
ri.entry |= exceptionBit
336336

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

341341
// Set the offset in the exceptionData array.

cases/gen_trieval.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ package main
1919
// The per-rune values have the following format:
2020
//
2121
// if (exception) {
22-
// 15..5 unsigned exception index
23-
// 4 unused
22+
// 15..4 unsigned exception index
2423
// } else {
2524
// 15..8 XOR pattern or index to XOR pattern for case mapping
2625
// Only 13..8 are used for XOR patterns.
@@ -52,8 +51,8 @@ const (
5251
isMidBit = 1 << 6
5352

5453
exceptionBit = 1 << 3
55-
exceptionShift = 5
56-
numExceptionBits = 11
54+
exceptionShift = 4
55+
numExceptionBits = 12
5756

5857
xorIndexBit = 1 << 6
5958
xorShift = 8

0 commit comments

Comments
 (0)