本站源代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 lines
2.8KB

  1. package roaring
  2. // NOTE: THIS FILE WAS PRODUCED BY THE
  3. // MSGP CODE GENERATION TOOL (github.com/tinylib/msgp)
  4. // DO NOT EDIT
  5. import "github.com/tinylib/msgp/msgp"
  6. // DecodeMsg implements msgp.Decodable
  7. func (z *arrayContainer) DecodeMsg(dc *msgp.Reader) (err error) {
  8. var field []byte
  9. _ = field
  10. var zbzg uint32
  11. zbzg, err = dc.ReadMapHeader()
  12. if err != nil {
  13. return
  14. }
  15. for zbzg > 0 {
  16. zbzg--
  17. field, err = dc.ReadMapKeyPtr()
  18. if err != nil {
  19. return
  20. }
  21. switch msgp.UnsafeString(field) {
  22. case "content":
  23. var zbai uint32
  24. zbai, err = dc.ReadArrayHeader()
  25. if err != nil {
  26. return
  27. }
  28. if cap(z.content) >= int(zbai) {
  29. z.content = (z.content)[:zbai]
  30. } else {
  31. z.content = make([]uint16, zbai)
  32. }
  33. for zxvk := range z.content {
  34. z.content[zxvk], err = dc.ReadUint16()
  35. if err != nil {
  36. return
  37. }
  38. }
  39. default:
  40. err = dc.Skip()
  41. if err != nil {
  42. return
  43. }
  44. }
  45. }
  46. return
  47. }
  48. // EncodeMsg implements msgp.Encodable
  49. func (z *arrayContainer) EncodeMsg(en *msgp.Writer) (err error) {
  50. // map header, size 1
  51. // write "content"
  52. err = en.Append(0x81, 0xa7, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74)
  53. if err != nil {
  54. return err
  55. }
  56. err = en.WriteArrayHeader(uint32(len(z.content)))
  57. if err != nil {
  58. return
  59. }
  60. for zxvk := range z.content {
  61. err = en.WriteUint16(z.content[zxvk])
  62. if err != nil {
  63. return
  64. }
  65. }
  66. return
  67. }
  68. // MarshalMsg implements msgp.Marshaler
  69. func (z *arrayContainer) MarshalMsg(b []byte) (o []byte, err error) {
  70. o = msgp.Require(b, z.Msgsize())
  71. // map header, size 1
  72. // string "content"
  73. o = append(o, 0x81, 0xa7, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74)
  74. o = msgp.AppendArrayHeader(o, uint32(len(z.content)))
  75. for zxvk := range z.content {
  76. o = msgp.AppendUint16(o, z.content[zxvk])
  77. }
  78. return
  79. }
  80. // UnmarshalMsg implements msgp.Unmarshaler
  81. func (z *arrayContainer) UnmarshalMsg(bts []byte) (o []byte, err error) {
  82. var field []byte
  83. _ = field
  84. var zcmr uint32
  85. zcmr, bts, err = msgp.ReadMapHeaderBytes(bts)
  86. if err != nil {
  87. return
  88. }
  89. for zcmr > 0 {
  90. zcmr--
  91. field, bts, err = msgp.ReadMapKeyZC(bts)
  92. if err != nil {
  93. return
  94. }
  95. switch msgp.UnsafeString(field) {
  96. case "content":
  97. var zajw uint32
  98. zajw, bts, err = msgp.ReadArrayHeaderBytes(bts)
  99. if err != nil {
  100. return
  101. }
  102. if cap(z.content) >= int(zajw) {
  103. z.content = (z.content)[:zajw]
  104. } else {
  105. z.content = make([]uint16, zajw)
  106. }
  107. for zxvk := range z.content {
  108. z.content[zxvk], bts, err = msgp.ReadUint16Bytes(bts)
  109. if err != nil {
  110. return
  111. }
  112. }
  113. default:
  114. bts, err = msgp.Skip(bts)
  115. if err != nil {
  116. return
  117. }
  118. }
  119. }
  120. o = bts
  121. return
  122. }
  123. // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
  124. func (z *arrayContainer) Msgsize() (s int) {
  125. s = 1 + 8 + msgp.ArrayHeaderSize + (len(z.content) * (msgp.Uint16Size))
  126. return
  127. }
上海开阖软件有限公司 沪ICP备12045867号-1