next returns the next entry from the postHeap. It returns a postEntry with trigram == 1<<24 - 1 if h is empty.
()
| 383 | // next returns the next entry from the postHeap. |
| 384 | // It returns a postEntry with trigram == 1<<24 - 1 if h is empty. |
| 385 | func (h *postHeap) next() postEntry { |
| 386 | if len(h.ch) == 0 { |
| 387 | return makePostEntry(1<<24-1, 0) |
| 388 | } |
| 389 | ch := h.ch[0] |
| 390 | e := ch.e |
| 391 | m := ch.m |
| 392 | if len(m) == 0 { |
| 393 | h.pop() |
| 394 | } else { |
| 395 | ch.e = m[0] |
| 396 | ch.m = m[1:] |
| 397 | h.siftDown(0) |
| 398 | } |
| 399 | return e |
| 400 | } |
| 401 | |
| 402 | func (h *postHeap) pop() *postChunk { |
| 403 | ch := h.ch[0] |