DecodeToBuffer is the same as Decode but it returns a z.Buffer which is calloc'ed and can be SHOULD be freed up by calling buffer.Release().
(buf *z.Buffer, pack *pb.UidPack)
| 454 | // DecodeToBuffer is the same as Decode but it returns a z.Buffer which is |
| 455 | // calloc'ed and can be SHOULD be freed up by calling buffer.Release(). |
| 456 | func DecodeToBuffer(buf *z.Buffer, pack *pb.UidPack) { |
| 457 | var last uint64 |
| 458 | tmp := make([]byte, 16) |
| 459 | dec := Decoder{Pack: pack} |
| 460 | for uids := dec.Seek(0, SeekStart); len(uids) > 0; uids = dec.Next() { |
| 461 | for _, u := range uids { |
| 462 | n := binary.PutUvarint(tmp, u-last) |
| 463 | x.Check2(buf.Write(tmp[:n])) |
| 464 | last = u |
| 465 | } |
| 466 | } |
| 467 | } |
| 468 | |
| 469 | func match32MSB(num1, num2 uint64) bool { |
| 470 | return (num1 & bitMask) == (num2 & bitMask) |