From 2fa7c464f019f67c5c0494aaf5ac0f5ecc1ee7a7 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Tue, 16 Jan 2018 12:03:31 -0500 Subject: Updated dependencies and added avct/uasurfer (#8089) * Updated dependencies and added avct/uasurfer * Added uasurfer to NOTICE.txt --- vendor/golang.org/x/text/internal/number/number.go | 58 +++++++++++----------- 1 file changed, 30 insertions(+), 28 deletions(-) (limited to 'vendor/golang.org/x/text/internal/number/number.go') diff --git a/vendor/golang.org/x/text/internal/number/number.go b/vendor/golang.org/x/text/internal/number/number.go index ea341c796..2a21f07d0 100644 --- a/vendor/golang.org/x/text/internal/number/number.go +++ b/vendor/golang.org/x/text/internal/number/number.go @@ -17,7 +17,7 @@ import ( // Info holds number formatting configuration data. type Info struct { system systemData // numbering system information - symIndex byte // index to symbols + symIndex symOffset // index to symbols } // InfoFromLangID returns a Info for the given compact language identifier and @@ -26,16 +26,16 @@ type Info struct { func InfoFromLangID(compactIndex int, numberSystem string) Info { p := langToDefaults[compactIndex] // Lookup the entry for the language. - pSymIndex := byte(0) // Default: Latin, default symbols + pSymIndex := symOffset(0) // Default: Latin, default symbols system, ok := systemMap[numberSystem] if !ok { // Take the value for the default numbering system. This is by far the // most common case as an alternative numbering system is hardly used. - if p&0x80 == 0 { + if p&hasNonLatnMask == 0 { // Latn digits. pSymIndex = p - } else { + } else { // Non-Latn or multiple numbering systems. // Take the first entry from the alternatives list. - data := langToAlt[p&^0x80] + data := langToAlt[p&^hasNonLatnMask] pSymIndex = data.symIndex system = data.system } @@ -43,8 +43,8 @@ func InfoFromLangID(compactIndex int, numberSystem string) Info { langIndex := compactIndex ns := system outerLoop: - for { - if p&0x80 == 0 { + for ; ; p = langToDefaults[langIndex] { + if p&hasNonLatnMask == 0 { if ns == 0 { // The index directly points to the symbol data. pSymIndex = p @@ -52,30 +52,32 @@ func InfoFromLangID(compactIndex int, numberSystem string) Info { } // Move to the parent and retry. langIndex = int(internal.Parent[langIndex]) - } - // The index points to a list of symbol data indexes. - for _, e := range langToAlt[p&^0x80:] { - if int(e.compactTag) != langIndex { - if langIndex == 0 { - // The CLDR root defines full symbol information for all - // numbering systems (even though mostly by means of - // aliases). This means that we will never fall back to - // the default of the language. Also, the loop is - // guaranteed to terminate as a consequence. - ns = numLatn - // Fall back to Latin and start from the original - // language. See - // http://unicode.org/reports/tr35/#Locale_Inheritance. - langIndex = compactIndex - } else { + } else { + // The index points to a list of symbol data indexes. + for _, e := range langToAlt[p&^hasNonLatnMask:] { + if int(e.compactTag) != langIndex { + if langIndex == 0 { + // The CLDR root defines full symbol information for + // all numbering systems (even though mostly by + // means of aliases). Fall back to the default entry + // for Latn if there is no data for the numbering + // system of this language. + if ns == 0 { + break + } + // Fall back to Latin and start from the original + // language. See + // http://unicode.org/reports/tr35/#Locale_Inheritance. + ns = numLatn + langIndex = compactIndex + continue outerLoop + } // Fall back to parent. langIndex = int(internal.Parent[langIndex]) + } else if e.system == ns { + pSymIndex = e.symIndex + break outerLoop } - break - } - if e.system == ns { - pSymIndex = e.symIndex - break outerLoop } } } -- cgit v1.2.3-1-g7c22