func AppendUint64(b []byte, u uint64) []byte {
	switch {
	case u <= math.MaxInt8:
		return append(b, wfixint(uint8(u)))
	case u <= math.MaxUint8:
		o, n := ensure(b, 2)
		putMuint8(o[n:], uint8(u))
		return o
	case u <= math.MaxUint16:
		o, n := ensure(b, 3)
		putMuint16(o[n:], uint16(u))
		return o
	case u <= math.MaxUint32:
		o, n := ensure(b, 5)
		putMuint32(o[n:], uint32(u))
		return o
	default:
		o, n := ensure(b, 9)
		putMuint64(o[n:], u)
		return o
	}
}
AppendUint64 appends a uint64 to b.
package msgp
import (
	"math"
	"reflect"
	"time"
)
func Require(old []byte, extra int) []byte {
	l := len(old)
	c := cap(old)
	r := l + extra
	if c >= r {
		return old
	}
	c <<= 1
	if c < r {
		c = r
	}
	n := make([]byte, l, c)
	copy(n, old)
	return n
}
func ensure(b []byte, size int) ([]byte, int) {
	b = Require(b, size)
	l := len(b)
	return b[:l+size], l
}
func AppendMapHeader(b []byte, size uint32) []byte {
	if size <= 15 {
		return append(b, wfixmap(uint8(size)))
	}
	if size <= math.MaxUint16 {
		o, n := ensure(b, 3)
		prefixu16(o[n:], mmap16, uint16(size))
		return o
	}
	o, n := ensure(b, 5)
	prefixu32(o[n:], mmap32, size)
	return o
}
func AppendArrayHeader(b []byte, size uint32) []byte {
	if size <= 15 {
		return append(b, wfixarray(uint8(size)))
	}
	if size <= math.MaxUint16 {
		o, n := ensure(b, 3)
		prefixu16(o[n:], marray16, uint16(size))
		return o
	}
	o, n := ensure(b, 5)
	prefixu32(o[n:], marray32, size)
	return o
}
func AppendNil(b []byte) []byte { return append(b, mnil) }
func AppendFloat64(b []byte, f float64) []byte {
	o, n := ensure(b, Float64Size)
	prefixu64(o[n:], mfloat64, math.Float64bits(f))
	return o
}
func AppendFloat32(b []byte, f float32) []byte {
	o, n := ensure(b, Float32Size)
	prefixu32(o[n:], mfloat32, math.Float32bits(f))
	return o
}
func AppendInt64(b []byte, i int64) []byte {
	if i >= 0 {
		switch {
		case i <= math.MaxInt8:
			return append(b, wfixint(uint8(i)))
		case i <= math.MaxInt16:
			o, n := ensure(b, 3)
			putMint16(o[n:], int16(i))
			return o
		case i <= math.MaxInt32:
			o, n := ensure(b, 5)
			putMint32(o[n:], int32(i))
			return o
		default:
			o, n := ensure(b, 9)
			putMint64(o[n:], i)
			return o
		}
	}
	switch {
	case i >= -32:
		return append(b, wnfixint(int8(i)))
	case i >= math.MinInt8:
		o, n := ensure(b, 2)
		putMint8(o[n:], int8(i))
		return o
	case i >= math.MinInt16:
		o, n := ensure(b, 3)
		putMint16(o[n:], int16(i))
		return o
	case i >= math.MinInt32:
		o, n := ensure(b, 5)
		putMint32(o[n:], int32(i))
		return o
	default:
		o, n := ensure(b, 9)
		putMint64(o[n:], i)
		return o
	}
}
func AppendInt8(b []byte, i int8) []byte {
	if i >= 0 {
		return append(b, wfixint(uint8(i)))
	}
	if i >= -32 {
		return append(b, wnfixint(i))
	}
	o, n := ensure(b, 2)
	putMint8(o[n:], i)
	return o
}
func AppendInt16(b []byte, i int16) []byte { return AppendInt64(b, int64(i)) }
func AppendInt32(b []byte, i int32) []byte { return AppendInt64(b, int64(i)) }