func (r *Reader) Range(buf *Buffer, chunk uint32, fn func(*Reader)) {
	for i, c := range buf.chunks {
		if c.Chunk != chunk {
			continue  
		}
		offset := c.Start
		buffer := buf.buffer[offset:]
		if len(buf.chunks) > i+1 {
			until := uint32(buf.chunks[i+1].Start)
			buffer = buf.buffer[offset:until]
		}
		r.use(buffer)
		r.Offset = int32(c.Value)
		r.start = int32(c.Value)
		fn(r)
	}
}
--------------------------- Chunk Iterator ----------------------------
Range iterates over parts of the buffer which match the specified chunk.
package commit
import (
	"encoding/binary"
	"math"
	"unsafe"
)
type Reader struct {
	head   int     
	i0, i1 int     
	Type   OpType  
	buffer []byte  
	Offset int32   
	start  int32   
}
func NewReader() *Reader {
	return &Reader{}
}
func (r *Reader) Seek(b *Buffer) {
	r.use(b.buffer)
}
func (r *Reader) Rewind() {
	r.use(r.buffer)
	r.Offset = r.start
}
func (r *Reader) use(buffer []byte) {
	r.buffer = buffer
	r.head = 0
	r.i0 = 0
	r.i1 = 0
	r.Offset = 0
	r.Type = Put
}
func (r *Reader) Int16() int16 {
	return int16(binary.BigEndian.Uint16(r.buffer[r.i0:r.i1]))
}
func (r *Reader) Int32() int32 {
	return int32(binary.BigEndian.Uint32(r.buffer[r.i0:r.i1]))
}
func (r *Reader) Int64() int64 {
	return int64(binary.BigEndian.Uint64(r.buffer[r.i0:r.i1]))
}
func (r *Reader) Uint16() uint16 {
	return binary.BigEndian.Uint16(r.buffer[r.i0:r.i1])
}
func (r *Reader) Uint32() uint32 {
	return binary.BigEndian.Uint32(r.buffer[r.i0:r.i1])
}
func (r *Reader) Uint64() uint64 {
	return binary.BigEndian.Uint64(r.buffer[r.i0:r.i1])
}
func (r *Reader) Float32() float32 {
	return math.Float32frombits(binary.BigEndian.Uint32(r.buffer[r.i0:r.i1]))
}
func (r *Reader) Float64() float64 {
	return math.Float64frombits(binary.BigEndian.Uint64(r.buffer[r.i0:r.i1]))
}
func (r *Reader) Number() float64 {
	return r.Float64()
}
func (r *Reader) Bytes() []byte {
	return r.buffer[r.i0:r.i1]
}
func (r *Reader) Index() uint32 {
	return uint32(r.Offset)
}
func (r *Reader) Int() int {
	return int(binary.BigEndian.Uint64(r.buffer[r.i0:r.i1]))
}
func (r *Reader) Uint() uint {
	return uint(binary.BigEndian.Uint64(r.buffer[r.i0:r.i1]))
}
func (r *Reader) Float() float64 {
	return r.Float64()
}
func (r *Reader) String() string {
	b := r.buffer[r.i0:r.i1]
	return *(*string)(unsafe.Pointer(&b))
}
func (r *Reader) Bool() bool {
	return r.Type == PutTrue
}
func (r *Reader) SwapInt16(v int16) {
	binary.BigEndian.PutUint16(r.buffer[r.i0:r.i1], uint16(v))
}
func (r *Reader) SwapInt32(v int32) {
	binary.BigEndian.PutUint32(r.buffer[r.i0:r.i1], uint32(v))
}
func (r *Reader) SwapInt64(v int64) {
	binary.BigEndian.PutUint64(r.buffer[r.i0:r.i1], uint64(v))
}
func (r *Reader) SwapInt(v int) {
	binary.BigEndian.PutUint64(r.buffer[r.i0:r.i1], uint64(v))
}
func (r *Reader) SwapUint16(v uint16) {
	binary.BigEndian.PutUint16(r.buffer[r.i0:r.i1], v)
}
func (r *Reader) SwapUint32(v uint32) {
	binary.BigEndian.PutUint32(r.buffer[r.i0:r.i1], v)
}
func (r *Reader) SwapUint64(v uint64) {
	binary.BigEndian.PutUint64(r.buffer[r.i0:r.i1], v)
}
func (r *Reader) SwapUint(v uint) {
	binary.BigEndian.PutUint64(r.buffer[r.i0:r.i1], uint64(v))
}
func (r *Reader) SwapFloat32(v float32) {
	binary.BigEndian.PutUint32(r.buffer[r.i0:r.i1], math.Float32bits(v))
}
func (r *Reader) SwapFloat64(v float64) {
	binary.BigEndian.PutUint64(r.buffer[r.i0:r.i1], math.Float64bits(v))
}
func (r *Reader) SwapNumber(v interface{}) {
	binary.BigEndian.PutUint64(r.buffer[r.i0:r.i1], math.Float64bits(v.(float64)))
}
func (r *Reader) SwapBool(b bool) {
	r.buffer[r.i0] = 0
	if b {
		r.buffer[r.i0] = 1
	}
}