Source file src/vendor/golang.org/x/net/idna/trie13.0.0.go
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 7 //go:build go1.16 8 9 package idna 10 11 // appendMapping appends the mapping for the respective rune. isMapped must be 12 // true. A mapping is a categorization of a rune as defined in UTS #46. 13 func (c info) appendMapping(b []byte, s string) []byte { 14 index := int(c >> indexShift) 15 if c&xorBit == 0 { 16 p := index 17 return append(b, mappings[mappingIndex[p]:mappingIndex[p+1]]...) 18 } 19 b = append(b, s...) 20 if c&inlineXOR == inlineXOR { 21 // TODO: support and handle two-byte inline masks 22 b[len(b)-1] ^= byte(index) 23 } else { 24 for p := len(b) - int(xorData[index]); p < len(b); p++ { 25 index++ 26 b[p] ^= xorData[index] 27 } 28 } 29 return b 30 } 31