Documentation
¶
Index ¶
- func BitmapSize(entityCount uint32) int
- func Clear(bm []byte, bit int)
- func Has(bm []byte, bit int) bool
- func PopCount(bm []byte) int
- func Set(bm []byte, bit int)
- type Data
- type Headers
- func (h *Headers) AppendName(name string) uint32
- func (h *Headers) EntityCount() uint32
- func (h *Headers) GroupingCount() uint32
- func (h *Headers) IndexOf(name string) int
- func (h *Headers) MagicNumber() [4]byte
- func (h *Headers) Names() []string
- func (h *Headers) SetMagicNumber(magicNumber [4]byte)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BitmapSize ¶
BitmapSize returns the number of bytes required to hold a bitmap for the given entity count.
Types ¶
type Data ¶
type Data []byte
Data is the binary-encoded payload of a Groupings object. It stores a concatenated sequence of fixed-size bitmaps, one per grouping, in the same order as the names table in Headers.
func (*Data) AppendBitmap ¶
AppendBitmap appends a new zero-initialised bitmap of the given size.
type Headers ¶
type Headers []byte
Headers is the binary-encoded header block of a Groupings payload.
Layout (little-endian):
[0..4] magic number (4 bytes) [4..8] entity count (uint32) [8..12] grouping count (uint32) [12..] names table: for each grouping, uint16 length + utf-8 name bytes
func NewHeaders ¶
NewHeaders returns a new Headers initialised with the given entity count and zero groupings.
func ParseHeaders ¶
ParseHeaders parses a Headers block from raw bytes and returns the parsed headers together with the number of bytes consumed.
func (*Headers) AppendName ¶
AppendName appends a grouping name to the names table and returns its index.
func (*Headers) EntityCount ¶
EntityCount returns the number of entities addressable by every grouping.
func (*Headers) GroupingCount ¶
GroupingCount returns the number of groupings.