Scott Baker | eee8dd8 | 2019-09-24 12:52:34 -0700 | [diff] [blame] | 1 | // Copyright 2013 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 | |
| 5 | package collate |
| 6 | |
| 7 | import "golang.org/x/text/internal/colltab" |
| 8 | |
| 9 | const blockSize = 64 |
| 10 | |
| 11 | func getTable(t tableIndex) *colltab.Table { |
| 12 | return &colltab.Table{ |
| 13 | Index: colltab.Trie{ |
| 14 | Index0: mainLookup[:][blockSize*t.lookupOffset:], |
| 15 | Values0: mainValues[:][blockSize*t.valuesOffset:], |
| 16 | Index: mainLookup[:], |
| 17 | Values: mainValues[:], |
| 18 | }, |
| 19 | ExpandElem: mainExpandElem[:], |
| 20 | ContractTries: colltab.ContractTrieSet(mainCTEntries[:]), |
| 21 | ContractElem: mainContractElem[:], |
| 22 | MaxContractLen: 18, |
| 23 | VariableTop: varTop, |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | // tableIndex holds information for constructing a table |
| 28 | // for a certain locale based on the main table. |
| 29 | type tableIndex struct { |
| 30 | lookupOffset uint32 |
| 31 | valuesOffset uint32 |
| 32 | } |