本站源代码
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.

416 lines
8.7KB

  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 *bitmapContainer) 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 "cardinality":
  23. z.cardinality, err = dc.ReadInt()
  24. if err != nil {
  25. return
  26. }
  27. case "bitmap":
  28. var zbai uint32
  29. zbai, err = dc.ReadArrayHeader()
  30. if err != nil {
  31. return
  32. }
  33. if cap(z.bitmap) >= int(zbai) {
  34. z.bitmap = (z.bitmap)[:zbai]
  35. } else {
  36. z.bitmap = make([]uint64, zbai)
  37. }
  38. for zxvk := range z.bitmap {
  39. z.bitmap[zxvk], err = dc.ReadUint64()
  40. if err != nil {
  41. return
  42. }
  43. }
  44. default:
  45. err = dc.Skip()
  46. if err != nil {
  47. return
  48. }
  49. }
  50. }
  51. return
  52. }
  53. // EncodeMsg implements msgp.Encodable
  54. func (z *bitmapContainer) EncodeMsg(en *msgp.Writer) (err error) {
  55. // map header, size 2
  56. // write "cardinality"
  57. err = en.Append(0x82, 0xab, 0x63, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79)
  58. if err != nil {
  59. return err
  60. }
  61. err = en.WriteInt(z.cardinality)
  62. if err != nil {
  63. return
  64. }
  65. // write "bitmap"
  66. err = en.Append(0xa6, 0x62, 0x69, 0x74, 0x6d, 0x61, 0x70)
  67. if err != nil {
  68. return err
  69. }
  70. err = en.WriteArrayHeader(uint32(len(z.bitmap)))
  71. if err != nil {
  72. return
  73. }
  74. for zxvk := range z.bitmap {
  75. err = en.WriteUint64(z.bitmap[zxvk])
  76. if err != nil {
  77. return
  78. }
  79. }
  80. return
  81. }
  82. // MarshalMsg implements msgp.Marshaler
  83. func (z *bitmapContainer) MarshalMsg(b []byte) (o []byte, err error) {
  84. o = msgp.Require(b, z.Msgsize())
  85. // map header, size 2
  86. // string "cardinality"
  87. o = append(o, 0x82, 0xab, 0x63, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79)
  88. o = msgp.AppendInt(o, z.cardinality)
  89. // string "bitmap"
  90. o = append(o, 0xa6, 0x62, 0x69, 0x74, 0x6d, 0x61, 0x70)
  91. o = msgp.AppendArrayHeader(o, uint32(len(z.bitmap)))
  92. for zxvk := range z.bitmap {
  93. o = msgp.AppendUint64(o, z.bitmap[zxvk])
  94. }
  95. return
  96. }
  97. // UnmarshalMsg implements msgp.Unmarshaler
  98. func (z *bitmapContainer) UnmarshalMsg(bts []byte) (o []byte, err error) {
  99. var field []byte
  100. _ = field
  101. var zcmr uint32
  102. zcmr, bts, err = msgp.ReadMapHeaderBytes(bts)
  103. if err != nil {
  104. return
  105. }
  106. for zcmr > 0 {
  107. zcmr--
  108. field, bts, err = msgp.ReadMapKeyZC(bts)
  109. if err != nil {
  110. return
  111. }
  112. switch msgp.UnsafeString(field) {
  113. case "cardinality":
  114. z.cardinality, bts, err = msgp.ReadIntBytes(bts)
  115. if err != nil {
  116. return
  117. }
  118. case "bitmap":
  119. var zajw uint32
  120. zajw, bts, err = msgp.ReadArrayHeaderBytes(bts)
  121. if err != nil {
  122. return
  123. }
  124. if cap(z.bitmap) >= int(zajw) {
  125. z.bitmap = (z.bitmap)[:zajw]
  126. } else {
  127. z.bitmap = make([]uint64, zajw)
  128. }
  129. for zxvk := range z.bitmap {
  130. z.bitmap[zxvk], bts, err = msgp.ReadUint64Bytes(bts)
  131. if err != nil {
  132. return
  133. }
  134. }
  135. default:
  136. bts, err = msgp.Skip(bts)
  137. if err != nil {
  138. return
  139. }
  140. }
  141. }
  142. o = bts
  143. return
  144. }
  145. // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
  146. func (z *bitmapContainer) Msgsize() (s int) {
  147. s = 1 + 12 + msgp.IntSize + 7 + msgp.ArrayHeaderSize + (len(z.bitmap) * (msgp.Uint64Size))
  148. return
  149. }
  150. // DecodeMsg implements msgp.Decodable
  151. func (z *bitmapContainerShortIterator) DecodeMsg(dc *msgp.Reader) (err error) {
  152. var field []byte
  153. _ = field
  154. var zhct uint32
  155. zhct, err = dc.ReadMapHeader()
  156. if err != nil {
  157. return
  158. }
  159. for zhct > 0 {
  160. zhct--
  161. field, err = dc.ReadMapKeyPtr()
  162. if err != nil {
  163. return
  164. }
  165. switch msgp.UnsafeString(field) {
  166. case "ptr":
  167. if dc.IsNil() {
  168. err = dc.ReadNil()
  169. if err != nil {
  170. return
  171. }
  172. z.ptr = nil
  173. } else {
  174. if z.ptr == nil {
  175. z.ptr = new(bitmapContainer)
  176. }
  177. var zcua uint32
  178. zcua, err = dc.ReadMapHeader()
  179. if err != nil {
  180. return
  181. }
  182. for zcua > 0 {
  183. zcua--
  184. field, err = dc.ReadMapKeyPtr()
  185. if err != nil {
  186. return
  187. }
  188. switch msgp.UnsafeString(field) {
  189. case "cardinality":
  190. z.ptr.cardinality, err = dc.ReadInt()
  191. if err != nil {
  192. return
  193. }
  194. case "bitmap":
  195. var zxhx uint32
  196. zxhx, err = dc.ReadArrayHeader()
  197. if err != nil {
  198. return
  199. }
  200. if cap(z.ptr.bitmap) >= int(zxhx) {
  201. z.ptr.bitmap = (z.ptr.bitmap)[:zxhx]
  202. } else {
  203. z.ptr.bitmap = make([]uint64, zxhx)
  204. }
  205. for zwht := range z.ptr.bitmap {
  206. z.ptr.bitmap[zwht], err = dc.ReadUint64()
  207. if err != nil {
  208. return
  209. }
  210. }
  211. default:
  212. err = dc.Skip()
  213. if err != nil {
  214. return
  215. }
  216. }
  217. }
  218. }
  219. case "i":
  220. z.i, err = dc.ReadInt()
  221. if err != nil {
  222. return
  223. }
  224. default:
  225. err = dc.Skip()
  226. if err != nil {
  227. return
  228. }
  229. }
  230. }
  231. return
  232. }
  233. // EncodeMsg implements msgp.Encodable
  234. func (z *bitmapContainerShortIterator) EncodeMsg(en *msgp.Writer) (err error) {
  235. // map header, size 2
  236. // write "ptr"
  237. err = en.Append(0x82, 0xa3, 0x70, 0x74, 0x72)
  238. if err != nil {
  239. return err
  240. }
  241. if z.ptr == nil {
  242. err = en.WriteNil()
  243. if err != nil {
  244. return
  245. }
  246. } else {
  247. // map header, size 2
  248. // write "cardinality"
  249. err = en.Append(0x82, 0xab, 0x63, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79)
  250. if err != nil {
  251. return err
  252. }
  253. err = en.WriteInt(z.ptr.cardinality)
  254. if err != nil {
  255. return
  256. }
  257. // write "bitmap"
  258. err = en.Append(0xa6, 0x62, 0x69, 0x74, 0x6d, 0x61, 0x70)
  259. if err != nil {
  260. return err
  261. }
  262. err = en.WriteArrayHeader(uint32(len(z.ptr.bitmap)))
  263. if err != nil {
  264. return
  265. }
  266. for zwht := range z.ptr.bitmap {
  267. err = en.WriteUint64(z.ptr.bitmap[zwht])
  268. if err != nil {
  269. return
  270. }
  271. }
  272. }
  273. // write "i"
  274. err = en.Append(0xa1, 0x69)
  275. if err != nil {
  276. return err
  277. }
  278. err = en.WriteInt(z.i)
  279. if err != nil {
  280. return
  281. }
  282. return
  283. }
  284. // MarshalMsg implements msgp.Marshaler
  285. func (z *bitmapContainerShortIterator) MarshalMsg(b []byte) (o []byte, err error) {
  286. o = msgp.Require(b, z.Msgsize())
  287. // map header, size 2
  288. // string "ptr"
  289. o = append(o, 0x82, 0xa3, 0x70, 0x74, 0x72)
  290. if z.ptr == nil {
  291. o = msgp.AppendNil(o)
  292. } else {
  293. // map header, size 2
  294. // string "cardinality"
  295. o = append(o, 0x82, 0xab, 0x63, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79)
  296. o = msgp.AppendInt(o, z.ptr.cardinality)
  297. // string "bitmap"
  298. o = append(o, 0xa6, 0x62, 0x69, 0x74, 0x6d, 0x61, 0x70)
  299. o = msgp.AppendArrayHeader(o, uint32(len(z.ptr.bitmap)))
  300. for zwht := range z.ptr.bitmap {
  301. o = msgp.AppendUint64(o, z.ptr.bitmap[zwht])
  302. }
  303. }
  304. // string "i"
  305. o = append(o, 0xa1, 0x69)
  306. o = msgp.AppendInt(o, z.i)
  307. return
  308. }
  309. // UnmarshalMsg implements msgp.Unmarshaler
  310. func (z *bitmapContainerShortIterator) UnmarshalMsg(bts []byte) (o []byte, err error) {
  311. var field []byte
  312. _ = field
  313. var zlqf uint32
  314. zlqf, bts, err = msgp.ReadMapHeaderBytes(bts)
  315. if err != nil {
  316. return
  317. }
  318. for zlqf > 0 {
  319. zlqf--
  320. field, bts, err = msgp.ReadMapKeyZC(bts)
  321. if err != nil {
  322. return
  323. }
  324. switch msgp.UnsafeString(field) {
  325. case "ptr":
  326. if msgp.IsNil(bts) {
  327. bts, err = msgp.ReadNilBytes(bts)
  328. if err != nil {
  329. return
  330. }
  331. z.ptr = nil
  332. } else {
  333. if z.ptr == nil {
  334. z.ptr = new(bitmapContainer)
  335. }
  336. var zdaf uint32
  337. zdaf, bts, err = msgp.ReadMapHeaderBytes(bts)
  338. if err != nil {
  339. return
  340. }
  341. for zdaf > 0 {
  342. zdaf--
  343. field, bts, err = msgp.ReadMapKeyZC(bts)
  344. if err != nil {
  345. return
  346. }
  347. switch msgp.UnsafeString(field) {
  348. case "cardinality":
  349. z.ptr.cardinality, bts, err = msgp.ReadIntBytes(bts)
  350. if err != nil {
  351. return
  352. }
  353. case "bitmap":
  354. var zpks uint32
  355. zpks, bts, err = msgp.ReadArrayHeaderBytes(bts)
  356. if err != nil {
  357. return
  358. }
  359. if cap(z.ptr.bitmap) >= int(zpks) {
  360. z.ptr.bitmap = (z.ptr.bitmap)[:zpks]
  361. } else {
  362. z.ptr.bitmap = make([]uint64, zpks)
  363. }
  364. for zwht := range z.ptr.bitmap {
  365. z.ptr.bitmap[zwht], bts, err = msgp.ReadUint64Bytes(bts)
  366. if err != nil {
  367. return
  368. }
  369. }
  370. default:
  371. bts, err = msgp.Skip(bts)
  372. if err != nil {
  373. return
  374. }
  375. }
  376. }
  377. }
  378. case "i":
  379. z.i, bts, err = msgp.ReadIntBytes(bts)
  380. if err != nil {
  381. return
  382. }
  383. default:
  384. bts, err = msgp.Skip(bts)
  385. if err != nil {
  386. return
  387. }
  388. }
  389. }
  390. o = bts
  391. return
  392. }
  393. // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
  394. func (z *bitmapContainerShortIterator) Msgsize() (s int) {
  395. s = 1 + 4
  396. if z.ptr == nil {
  397. s += msgp.NilSize
  398. } else {
  399. s += 1 + 12 + msgp.IntSize + 7 + msgp.ArrayHeaderSize + (len(z.ptr.bitmap) * (msgp.Uint64Size))
  400. }
  401. s += 2 + msgp.IntSize
  402. return
  403. }
上海开阖软件有限公司 沪ICP备12045867号-1