func getNextSize(r *fwd.Reader) (uintptr, uintptr, error) {
	b, err := r.Peek(1)
	if err != nil {
		return 0, 0, err
	}
	lead := b[0]
	spec := &sizes[lead]
	size, mode := spec.size, spec.extra
	if size == 0 {
		return 0, 0, InvalidPrefixError(lead)
	}
	if mode >= 0 {
		return uintptr(size), uintptr(mode), nil
	}
	b, err = r.Peek(int(size))
	if err != nil {
		return 0, 0, err
	}
	switch mode {
	case extra8:
		return uintptr(size) + uintptr(b[1]), 0, nil
	case extra16:
		return uintptr(size) + uintptr(big.Uint16(b[1:])), 0, nil
	case extra32:
		return uintptr(size) + uintptr(big.Uint32(b[1:])), 0, nil
	case map16v:
		return uintptr(size), 2 * uintptr(big.Uint16(b[1:])), nil
	case map32v:
		return uintptr(size), 2 * uintptr(big.Uint32(b[1:])), nil
	case array16v:
		return uintptr(size), uintptr(big.Uint16(b[1:])), nil
	case array32v:
		return uintptr(size), uintptr(big.Uint32(b[1:])), nil
	default:
		return 0, 0, fatal
	}
}
getNextSize returns the size of the next object on the wire.
returns (obj size, obj elements, error)
only maps and arrays have non-zero obj elements
for maps and arrays, obj size does not include elements

use uintptr b/c it's guaranteed to be large enough
to hold whatever we can fit in memory.
package msgp
import (
	"io"
	"math"
	"sync"
	"time"
	"github.com/gofiber/fiber/v2/internal/fwd"
)
var readerPool = sync.Pool{New: func() interface{} { return &Reader{} }}
type Type byte
const (
	InvalidType Type = iota
	StrType
	BinType
	MapType
	ArrayType
	Float64Type
	Float32Type
	BoolType
	IntType
	UintType
	NilType
	ExtensionType
	Complex64Type
	Complex128Type
	TimeType
	_maxtype
)
func (t Type) String() string {
	switch t {
	case StrType:
		return "str"
	case BinType:
		return "bin"
	case MapType:
		return "map"
	case ArrayType:
		return "array"
	case Float64Type:
		return "float64"
	case Float32Type:
		return "float32"
	case BoolType:
		return "bool"
	case UintType:
		return "uint"
	case IntType:
		return "int"
	case ExtensionType:
		return "ext"
	case NilType:
		return "nil"
	default:
		return "<invalid>"
	}
}
func freeR(m *Reader) {
	readerPool.Put(m)
}
type Unmarshaler interface {
	UnmarshalMsg([]byte) ([]byte, error)
}
type Decodable interface {
	DecodeMsg(*Reader) error
}
func Decode(r io.Reader, d Decodable) error {
	rd := NewReader(r)
	err := d.DecodeMsg(rd)
	freeR(rd)
	return err
}
func NewReader(r io.Reader) *Reader {
	p := readerPool.Get().(*Reader)
	if p.R == nil {
		p.R = fwd.NewReader(r)
	} else {
		p.R.Reset(r)
	}
	return p
}
func NewReaderSize(r io.Reader, sz int) *Reader {
	return &Reader{R: fwd.NewReaderSize(r, sz)}
}
func NewReaderBuf(r io.Reader, buf []byte) *Reader {
	return &Reader{R: fwd.NewReaderBuf(r, buf)}
}
type Reader struct {
	R       *fwd.Reader
	scratch []byte
}
func (m *Reader) Read(p []byte) (int, error) {
	return m.R.Read(p)
}
func (m *Reader) CopyNext(w io.Writer) (int64, error) {
	sz, o, err := getNextSize(m.R)
	if err != nil {
		return 0, err
	}
	var n int64
	if int(sz) <= m.R.BufferSize() {
		var nn int
		var buf []byte
		buf, err = m.R.Next(int(sz))
		if err != nil {
			if err == io.ErrUnexpectedEOF {
				err = ErrShortBytes
			}
			return 0, err
		}
		nn, err = w.Write(buf)
		n += int64(nn)
	} else {
		n, err = io.CopyN(w, m.R, int64(sz))
		if err == io.ErrUnexpectedEOF {
			err = ErrShortBytes
		}
	}
	if err != nil {
		return n, err
	} else if n < int64(sz) {
		return n, io.ErrShortWrite
	}
	for x := uintptr(0); x < o; x++ {
		var n2 int64
		n2, err = m.CopyNext(w)
		if err != nil {
			return n, err
		}
		n += n2
	}
	return n, nil
}
func (m *Reader) ReadFull(p []byte) (int, error) {
	return m.R.ReadFull(p)
}
func (m *Reader) Reset(r io.Reader) { m.R.Reset(r) }
func (m *Reader) Buffered() int { return m.R.Buffered() }
func (m *Reader) BufferSize() int { return m.R.BufferSize() }
func (m *Reader) NextType() (Type, error) {
	p, err := m.R.Peek(1)
	if err != nil {
		return InvalidType, err
	}
	t := getType(p[0])
	if t == InvalidType {
		return t, InvalidPrefixError(p[0])
	}
	if t == ExtensionType {
		v, err := m.peekExtensionType()
		if err != nil {
			return InvalidType, err
		}
		switch v {
		case Complex64Extension:
			return Complex64Type, nil
		case Complex128Extension:
			return Complex128Type, nil
		case TimeExtension:
			return TimeType, nil
		}
	}
	return t, nil
}
func (m *Reader) IsNil() bool {
	p, err := m.R.Peek(1)
	return err == nil && p[0] == mnil
}