func GetFloat64(p *float64) float64 {
	if p == nil {
		return 0
	}
	return *p
}
GetFloat64 is a helper routine that returns an optional float64 value.
package proto
import (
	"fmt"
	"log"
	"reflect"
	"strconv"
	"sync"
)
type Stats struct {
	Emalloc uint64  
	Dmalloc uint64  
	Encode  uint64  
	Decode  uint64  
	Chit    uint64  
	Cmiss   uint64  
}
var stats Stats
func GetStats() Stats { return stats }
type Buffer struct {
	buf       []byte      
	index     int         
	freelist  [10][]byte  
	nfreelist int         
	ptr       uintptr     
}
func NewBuffer(e []byte) *Buffer {
	p := new(Buffer)
	if e == nil {
		e = p.bufalloc()
	}
	p.buf = e
	p.index = 0
	return p
}
func (p *Buffer) Reset() {
	if p.buf == nil {
		p.buf = p.bufalloc()
	}
	p.buf = p.buf[0:0]  
	p.index = 0         
}
func (p *Buffer) SetBuf(s []byte) {
	p.buf = s
	p.index = 0
}
func (p *Buffer) Bytes() []byte { return p.buf }
func (p *Buffer) bufalloc() []byte {
	if p.nfreelist > 0 {
		p.nfreelist--
		s := p.freelist[p.nfreelist]
		return s[0:0]
	}
	s := make([]byte, 0, 16)
	return s
}
func (p *Buffer) buffree(s []byte) {
	if p.nfreelist < len(p.freelist) {
		p.freelist[p.nfreelist] = s
		p.nfreelist++
		return
	}
	besti := -1
	bestl := len(s)
	for i, b := range p.freelist {
		if len(b) < bestl {
			besti = i
			bestl = len(b)
		}
	}
	if besti >= 0 {
		p.freelist[besti] = s
	}
}
func Bool(v bool) *bool {
	p := new(bool)
	*p = v
	return p
}
func Int32(v int32) *int32 {
	p := new(int32)
	*p = v
	return p
}
func Int(v int) *int32 {
	p := new(int32)
	*p = int32(v)
	return p
}
func Int64(v int64) *int64 {
	p := new(int64)
	*p = v
	return p
}
func Float32(v float32) *float32 {
	p := new(float32)
	*p = v
	return p
}
func Float64(v float64) *float64 {
	p := new(float64)
	*p = v
	return p
}
func Uint32(v uint32) *uint32 {
	p := new(uint32)
	*p = v
	return p
}
func Uint64(v uint64) *uint64 {
	p := new(uint64)
	*p = v
	return p
}
func String(v string) *string {
	p := new(string)
	*p = v
	return p
}
func GetBool(p *bool) bool {
	if p == nil {
		return false
	}
	return *p
}
func GetInt32(p *int32) int32 {
	if p == nil {
		return 0
	}
	return *p
}
func GetInt64(p *int64) int64 {
	if p == nil {
		return 0
	}
	return *p
}
func GetFloat32(p *float32) float32 {
	if p == nil {
		return 0
	}
	return *p
}