aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/golang.org/x/text/unicode/norm/trie.go
diff options
context:
space:
mode:
authorLibravatar Rutger Broekhoff2024-01-02 18:56:31 +0100
committerLibravatar Rutger Broekhoff2024-01-02 18:56:31 +0100
commit8db41da676ac8368ef7c2549d56239a5ff5eedde (patch)
tree09c427fd66de2ec1ebffc8342f5fdbb84b0701b5 /vendor/golang.org/x/text/unicode/norm/trie.go
parentd4f75fb6db22e57577867445a022227e70958931 (diff)
downloadgitolfs3-8db41da676ac8368ef7c2549d56239a5ff5eedde.tar.gz
gitolfs3-8db41da676ac8368ef7c2549d56239a5ff5eedde.zip
Delete vendor directory
Diffstat (limited to 'vendor/golang.org/x/text/unicode/norm/trie.go')
-rw-r--r--vendor/golang.org/x/text/unicode/norm/trie.go54
1 files changed, 0 insertions, 54 deletions
diff --git a/vendor/golang.org/x/text/unicode/norm/trie.go b/vendor/golang.org/x/text/unicode/norm/trie.go
deleted file mode 100644
index e4250ae..0000000
--- a/vendor/golang.org/x/text/unicode/norm/trie.go
+++ /dev/null
@@ -1,54 +0,0 @@
1// Copyright 2011 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package norm
6
7type valueRange struct {
8 value uint16 // header: value:stride
9 lo, hi byte // header: lo:n
10}
11
12type sparseBlocks struct {
13 values []valueRange
14 offset []uint16
15}
16
17var nfcSparse = sparseBlocks{
18 values: nfcSparseValues[:],
19 offset: nfcSparseOffset[:],
20}
21
22var nfkcSparse = sparseBlocks{
23 values: nfkcSparseValues[:],
24 offset: nfkcSparseOffset[:],
25}
26
27var (
28 nfcData = newNfcTrie(0)
29 nfkcData = newNfkcTrie(0)
30)
31
32// lookup determines the type of block n and looks up the value for b.
33// For n < t.cutoff, the block is a simple lookup table. Otherwise, the block
34// is a list of ranges with an accompanying value. Given a matching range r,
35// the value for b is by r.value + (b - r.lo) * stride.
36func (t *sparseBlocks) lookup(n uint32, b byte) uint16 {
37 offset := t.offset[n]
38 header := t.values[offset]
39 lo := offset + 1
40 hi := lo + uint16(header.lo)
41 for lo < hi {
42 m := lo + (hi-lo)/2
43 r := t.values[m]
44 if r.lo <= b && b <= r.hi {
45 return r.value + uint16(b-r.lo)*header.value
46 }
47 if b < r.lo {
48 hi = m
49 } else {
50 lo = m + 1
51 }
52 }
53 return 0
54}