Source File
compact.go
Belonging Package
golang.org/x/text/internal/language
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package language
// CompactCoreInfo is a compact integer with the three core tags encoded.
type CompactCoreInfo uint32
// GetCompactCore generates a uint32 value that is guaranteed to be unique for
// different language, region, and script values.
func ( Tag) ( CompactCoreInfo, bool) {
if .LangID > langNoIndexOffset {
return 0, false
}
|= CompactCoreInfo(.LangID) << (8 + 12)
|= CompactCoreInfo(.ScriptID) << 12
|= CompactCoreInfo(.RegionID)
return , true
}
// Tag generates a tag from c.
func ( CompactCoreInfo) () Tag {
return Tag{
LangID: Language( >> 20),
RegionID: Region( & 0x3ff),
ScriptID: Script(>>12) & 0xff,
}
}
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |