func New(minShift, depth int) *Index {
	if minShift == 0 {
		minShift = DefaultShift
	}
	if depth == 0 {
		depth = DefaultDepth
	}
	return &Index{Version: 0x2, minShift: uint32(minShift), depth: uint32(depth)}
}
New returns a CSI index with the given minimum shift and depth.
The returned index defaults to CSI version 2.
package csi
import (
	"errors"
	"sort"
	"github.com/biogo/hts/bgzf"
	"github.com/biogo/hts/bgzf/index"
)
var csiMagic = [3]byte{'C', 'S', 'I'}
const (
	DefaultShift = 14
	DefaultDepth = 5
)
const nextBinShift = 3
func MinimumShiftFor(max int64, depth uint32) (uint32, bool) {
	for shift := uint32(0); shift < 32; shift++ {
		if validIndexPos(int(max), shift, depth) {
			return shift, true
		}
	}
	return 0, false
}
func MinimumDepthFor(max int64, shift uint32) (uint32, bool) {
	for depth := uint32(0); depth < 32; depth++ {
		if validIndexPos(int(max), shift, depth) {
			return depth, true
		}
	}
	return 0, false
}
func validIndexPos(i int, minShift, depth uint32) bool {  
	return -1 <= i && i <= (1<<(minShift+depth*nextBinShift)-1)-1
}