trie12.0.0.go 870 B

12345678910111213141516171819202122232425262728293031
  1. // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
  2. // Copyright 2016 The Go Authors. All rights reserved.
  3. // Use of this source code is governed by a BSD-style
  4. // license that can be found in the LICENSE file.
  5. //go:build !go1.16
  6. // +build !go1.16
  7. package idna
  8. // appendMapping appends the mapping for the respective rune. isMapped must be
  9. // true. A mapping is a categorization of a rune as defined in UTS #46.
  10. func (c info) appendMapping(b []byte, s string) []byte {
  11. index := int(c >> indexShift)
  12. if c&xorBit == 0 {
  13. s := mappings[index:]
  14. return append(b, s[1:s[0]+1]...)
  15. }
  16. b = append(b, s...)
  17. if c&inlineXOR == inlineXOR {
  18. // TODO: support and handle two-byte inline masks
  19. b[len(b)-1] ^= byte(index)
  20. } else {
  21. for p := len(b) - int(xorData[index]); p < len(b); p++ {
  22. index++
  23. b[p] ^= xorData[index]
  24. }
  25. }
  26. return b
  27. }