// 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,
	}
}