func (sketch *Sketch) Get(val []byte) uint64 {
	pos := sketch.getPos(val)
	return sketch.decode(pos)
}
Get returns the frequency of val in the sketch
package cmts
import (
	"fmt"
	"math"
	metro "github.com/dgryski/go-metro"
	bitset "github.com/willf/bitset"
)
func lsb(val uint64) (r uint64) {
	for r = 0; val&0x8000000000000000 == 0 && r < 64; r++ {
		val <<= 1
	}
	return 64 - r
}
type Sketch struct {
	barrier  []*bitset.BitSet
	counting []*bitset.BitSet
	nblayer  uint64
	baseSize uint64
	spire    uint64
}
func New(baseSize uint) *Sketch {
	nblayer := uint64(math.Log2(float64(baseSize))) + 1
	barrier := make([]*bitset.BitSet, nblayer, nblayer)
	counting := make([]*bitset.BitSet, nblayer, nblayer)
	origBaseSize := uint64(baseSize)
	for i := uint64(0); i < nblayer; i++ {
		barrier[i] = bitset.New(baseSize)
		counting[i] = bitset.New(baseSize)
		baseSize /= 2
	}
	return &Sketch{
		barrier:  barrier,
		counting: counting,
		nblayer:  nblayer,
		baseSize: origBaseSize,
	}
}
func (sketch *Sketch) getPos(val []byte) uint {
	x := metro.Hash64(val, 0)
	pos := uint(x % sketch.baseSize)
	return pos
}
func (sketch *Sketch) Increment(val []byte) {
	pos := sketch.getPos(val)
	sketch.encode(pos)
}
func (sketch *Sketch) encode(pos uint) {
	nblayer := sketch.nblayer
	nv := sketch.decode(pos) + 1  
	x := (nv + 2) / 4             
	lsb := lsb(x)                 
	var nb uint64                 
	if nblayer < lsb {
		nb = nblayer
	} else {
		nb = lsb
	}
	nc := nv - 2*uint64((math.Pow(2, float64(nb))-1))
	tpos := pos
	for i := uint64(0); i < nb; i++ {
		sketch.barrier[i].Set(tpos)
		tpos /= 2
	}
	nb++
	tpos = pos
	for i := uint64(0); i < nb && i < nblayer; i++ {
		sketch.counting[i].SetTo(tpos, nc%2 != 0)
		nc >>= 1
		tpos /= 2
	}
	nb = nb >> sketch.nblayer << sketch.nblayer
	if sketch.spire < nc {
		sketch.spire = nc
	}
}