aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/golang.org/x/net/idna/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/net/idna/trie.go
parentd4f75fb6db22e57577867445a022227e70958931 (diff)
downloadgitolfs3-8db41da676ac8368ef7c2549d56239a5ff5eedde.tar.gz
gitolfs3-8db41da676ac8368ef7c2549d56239a5ff5eedde.zip
Delete vendor directory
Diffstat (limited to 'vendor/golang.org/x/net/idna/trie.go')
-rw-r--r--vendor/golang.org/x/net/idna/trie.go51
1 files changed, 0 insertions, 51 deletions
diff --git a/vendor/golang.org/x/net/idna/trie.go b/vendor/golang.org/x/net/idna/trie.go
deleted file mode 100644
index 4212741..0000000
--- a/vendor/golang.org/x/net/idna/trie.go
+++ /dev/null
@@ -1,51 +0,0 @@
1// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
2
3// Copyright 2016 The Go Authors. All rights reserved.
4// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file.
6
7package idna
8
9// Sparse block handling code.
10
11type valueRange struct {
12 value uint16 // header: value:stride
13 lo, hi byte // header: lo:n
14}
15
16type sparseBlocks struct {
17 values []valueRange
18 offset []uint16
19}
20
21var idnaSparse = sparseBlocks{
22 values: idnaSparseValues[:],
23 offset: idnaSparseOffset[:],
24}
25
26// Don't use newIdnaTrie to avoid unconditional linking in of the table.
27var trie = &idnaTrie{}
28
29// lookup determines the type of block n and looks up the value for b.
30// For n < t.cutoff, the block is a simple lookup table. Otherwise, the block
31// is a list of ranges with an accompanying value. Given a matching range r,
32// the value for b is by r.value + (b - r.lo) * stride.
33func (t *sparseBlocks) lookup(n uint32, b byte) uint16 {
34 offset := t.offset[n]
35 header := t.values[offset]
36 lo := offset + 1
37 hi := lo + uint16(header.lo)
38 for lo < hi {
39 m := lo + (hi-lo)/2
40 r := t.values[m]
41 if r.lo <= b && b <= r.hi {
42 return r.value + uint16(b-r.lo)*header.value
43 }
44 if b < r.lo {
45 hi = m
46 } else {
47 lo = m + 1
48 }
49 }
50 return 0
51}