"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "vendor/golang.org/x/text/unicode/norm/forminfo.go" between
etcd-3.4.12.tar.gz and etcd-3.4.13.tar.gz

About: etcd is a distributed reliable key-value store for the most critical data of a distributed system (written in "Go").

forminfo.go  (etcd-3.4.12):forminfo.go  (etcd-3.4.13)
// Copyright 2011 The Go Authors. All rights reserved. // Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
package norm package norm
import "encoding/binary"
// This file contains Form-specific logic and wrappers for data in tables.go. // This file contains Form-specific logic and wrappers for data in tables.go.
// Rune info is stored in a separate trie per composing form. A composing form // Rune info is stored in a separate trie per composing form. A composing form
// and its corresponding decomposing form share the same trie. Each trie maps // and its corresponding decomposing form share the same trie. Each trie maps
// a rune to a uint16. The values take two forms. For v >= 0x8000: // a rune to a uint16. The values take two forms. For v >= 0x8000:
// bits // bits
// 15: 1 (inverse of NFD_QC bit of qcInfo) // 15: 1 (inverse of NFD_QC bit of qcInfo)
// 13..7: qcInfo (see below). isYesD is always true (no decompostion). // 13..7: qcInfo (see below). isYesD is always true (no decompostion).
// 6..0: ccc (compressed CCC value). // 6..0: ccc (compressed CCC value).
// For v < 0x8000, the respective rune has a decomposition and v is an index // For v < 0x8000, the respective rune has a decomposition and v is an index
skipping to change at line 181 skipping to change at line 183
func (p Properties) LeadCCC() uint8 { func (p Properties) LeadCCC() uint8 {
return ccc[p.ccc] return ccc[p.ccc]
} }
// TrailCCC returns the CCC of the last rune in the decomposition. // TrailCCC returns the CCC of the last rune in the decomposition.
// If there is no decomposition, TrailCCC equals CCC. // If there is no decomposition, TrailCCC equals CCC.
func (p Properties) TrailCCC() uint8 { func (p Properties) TrailCCC() uint8 {
return ccc[p.tccc] return ccc[p.tccc]
} }
func buildRecompMap() {
recompMap = make(map[uint32]rune, len(recompMapPacked)/8)
var buf [8]byte
for i := 0; i < len(recompMapPacked); i += 8 {
copy(buf[:], recompMapPacked[i:i+8])
key := binary.BigEndian.Uint32(buf[:4])
val := binary.BigEndian.Uint32(buf[4:])
recompMap[key] = rune(val)
}
}
// Recomposition // Recomposition
// We use 32-bit keys instead of 64-bit for the two codepoint keys. // We use 32-bit keys instead of 64-bit for the two codepoint keys.
// This clips off the bits of three entries, but we know this will not // This clips off the bits of three entries, but we know this will not
// result in a collision. In the unlikely event that changes to // result in a collision. In the unlikely event that changes to
// UnicodeData.txt introduce collisions, the compiler will catch it. // UnicodeData.txt introduce collisions, the compiler will catch it.
// Note that the recomposition map for NFC and NFKC are identical. // Note that the recomposition map for NFC and NFKC are identical.
// combine returns the combined rune or 0 if it doesn't exist. // combine returns the combined rune or 0 if it doesn't exist.
//
// The caller is responsible for calling
// recompMapOnce.Do(buildRecompMap) sometime before this is called.
func combine(a, b rune) rune { func combine(a, b rune) rune {
key := uint32(uint16(a))<<16 + uint32(uint16(b)) key := uint32(uint16(a))<<16 + uint32(uint16(b))
if recompMap == nil {
panic("caller error") // see func comment
}
return recompMap[key] return recompMap[key]
} }
func lookupInfoNFC(b input, i int) Properties { func lookupInfoNFC(b input, i int) Properties {
v, sz := b.charinfoNFC(i) v, sz := b.charinfoNFC(i)
return compInfo(v, sz) return compInfo(v, sz)
} }
func lookupInfoNFKC(b input, i int) Properties { func lookupInfoNFKC(b input, i int) Properties {
v, sz := b.charinfoNFKC(i) v, sz := b.charinfoNFKC(i)
 End of changes. 4 change blocks. 
0 lines changed or deleted 19 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)