Expand description
Bitset implementation.
Bitsets are powered by the bitset_core
crate.
A Bones bitset is a vector of 32-byte sectors. The size of a bitset can be controlled by the
keysize*
features (note that they are all mutually exclusive with each other). The keysize
is exponentially correlated to the number of bits, or entities, that the set can track; where
the number of bits equals two raised to the power of keysize
. Below are the available
keysize
s and the size of their resulting bitsets.
Keysize | Bit Count | Sectors | Memory |
---|---|---|---|
32 | 4 billion | 16 million | 512 MB |
24 | 16 million | 65536 | 2 MB |
20 | 1 million | 4096 | 128 KB |
16 | 65536 | 256 | 8 KB |
12 | 4096 | 16 | 512 B |
10 | 1024 | 4 | 128 B |
Keysize (K
) refers to the name of the feature. A keysize of 16 refers to the keysize16
feature.
Bit Count is the total number of bits in the bitset (2^K
). Due to the nature of binary
numbers this means that a value with more than K
bits should not be used to index into the
bitset since e.g. u16::MAX
is the index of the last bit in a keysize16
bitset.
Sectors is the number of sub-arrays within the bitset Vec
. Sectors are 256 bits as they are
comprised of 8 u32
s. Note that SIMD instructions process 256 bits/entities at a time.
Memory is the total amount of memory that the bitset will occupy.
Macros§
- Shorthand for combining bitsets with bit_or.
- Shorthand for setting bits on the bitset container.
- Implements the
BitSet
trait members for your type throughDerefMut
.
Structs§
- BitSet formatter.
- The type of bitsets used to track entities in component storages. Mostly used to create caches.
Constants§
Traits§
- The BitSet API.
Functions§
- Creates a bitset big enough to contain the index of each entity. Mostly used to create caches.