package ecs

const (
	idMapChunkSize = 16
)

// idMap is a fast mapping data structure for graph node neighbors.
type idMap struct {
	data []nodeID // nodes, indexed by component added or removed
	used bitMask  // bit-mask of used indices
}

// newIDMap creates a new idMap.
func newIDMap() idMap {
	return idMap{
		data: make([]nodeID, idMapChunkSize),
	}
}

// Get returns the value at the given key and whether the key is present.
func ( *idMap) ( uint8) (nodeID, bool) {
	if !.used.Get() {
		return 0, false
	}
	return .data[], true
}

// Set sets the value at the given key.
func ( *idMap) ( uint8,  nodeID) {
	if len(.data) <= int() {
		 := ((uint32() + idMapChunkSize) / idMapChunkSize) * idMapChunkSize
		 := make([]nodeID, )
		copy(, .data)
		.data = 
	}
	.used.Set()
	.data[] = 
}