Source File
id_map.go
Belonging Package
github.com/mlange-42/ark/ecs
package ecsconst (idMapChunkSize = 16)// idMap is a fast mapping data structure for graph node neighbors.type idMap struct {data []nodeID // nodes, indexed by component added or removedused 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[] =}
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |