func (s *symbols) update(node *huffman.Node) {
	ls, count := s.leaves, node.Count
	idx := sort.Search(len(ls)-extraValues, func(i int) bool { return ls[i].Count <= count })
	idx2 := idx  
	for ; ls[idx] != node; idx++ {
	}
	if idx2 != idx {
		ls[idx2], ls[idx] = ls[idx], ls[idx2]
	}
	node.Count++
	s.updateWin(node.Value)
	s.rebuildTree()
}
update updates the symbol table by incrementing the occurrence count of the specified Node.
package hufio
import (
	"github.com/icza/huffman"
	"sort"
)
const (
	newValue    huffman.ValueType   = 1<<31 - 1 - iota  
	eofValue                                            
	extraValues = iota                                  
	maxValues   = 256 + extraValues                     
)
type win struct {
	buf    []huffman.ValueType  
	pos    int                  
	filled bool                 
}
func (w *win) store(symbol huffman.ValueType) {
	w.buf[w.pos] = symbol
	w.pos++
	if w.pos == len(w.buf) {
		w.pos = 0
		if !w.filled {
			w.filled = true
		}
	}
}
type symbols struct {
	leaves []*huffman.Node
	buffer []*huffman.Node  
	root *huffman.Node  
	valueMap map[huffman.ValueType]*huffman.Node  
	win *win  
}
func newSymbols(o *Options) *symbols {
	leaves := make([]*huffman.Node, extraValues, maxValues)
	leaves[0] = &huffman.Node{Value: newValue, Count: 1}
	leaves[1] = &huffman.Node{Value: eofValue, Count: 1}
	valueMap := make(map[huffman.ValueType]*huffman.Node, cap(leaves))
	for _, v := range leaves {
		valueMap[v.Value] = v
	}
	s := &symbols{leaves: leaves, valueMap: valueMap, buffer: make([]*huffman.Node, 0, maxValues)}
	if o.WinSize > 0 {
		s.win = &win{buf: make([]huffman.ValueType, o.WinSize)}
	}
	s.rebuildTree()
	return s
}