func (b *buffer) ReadTag() tag {
	return tag(b.Read16())
}
ReadTag reads a Tag value.
package p9
import (
	"encoding/binary"
)
type encoder interface {
	decode(b *buffer)
	encode(b *buffer)
}
var order = binary.LittleEndian
type buffer struct {
	data []byte
	overflow bool
}
func (b *buffer) append(n int) []byte {
	b.data = append(b.data, make([]byte, n)...)
	return b.data[len(b.data)-n:]
}
func (b *buffer) consume(n int) ([]byte, bool) {
	if !b.has(n) {
		b.markOverrun()
		return nil, false
	}
	rval := b.data[:n]
	b.data = b.data[n:]
	return rval, true
}
func (b *buffer) has(n int) bool {
	return len(b.data) >= n
}
func (b *buffer) markOverrun() {
	b.overflow = true
}
func (b *buffer) isOverrun() bool {
	return b.overflow
}
func (b *buffer) Read8() uint8 {
	v, ok := b.consume(1)
	if !ok {
		return 0
	}
	return uint8(v[0])
}
func (b *buffer) Read16() uint16 {
	v, ok := b.consume(2)
	if !ok {
		return 0
	}
	return order.Uint16(v)
}
func (b *buffer) Read32() uint32 {
	v, ok := b.consume(4)
	if !ok {
		return 0
	}
	return order.Uint32(v)
}
func (b *buffer) Read64() uint64 {
	v, ok := b.consume(8)
	if !ok {
		return 0
	}
	return order.Uint64(v)
}
func (b *buffer) ReadQIDType() QIDType {
	return QIDType(b.Read8())
}