| 1 |
# One-Bit-After Tail Index |
| 2 |
|
| 3 |
This is a semantic bit-index within *or one bit after* an `R` register. It is |
| 4 |
the index of the first “dead” bit after a “live” region, and corresponds to the |
| 5 |
similar half-open range concept in the Rust `Range` type or the LLVM memory |
| 6 |
model, pointer values include the address one object past the end of a region. |
| 7 |
|
| 8 |
It is a counter in the ring `0 ..= R::BITS` (note the inclusive high end). Like |
| 9 |
[`BitIdx`], this is a virtual semantic index with no bearing on real memory |
| 10 |
effects; unlike `BitIdx`, it can never be translated to real memory because it |
| 11 |
does not describe real memory. |
| 12 |
|
| 13 |
This type is necessary in order to preserve the distinction between a dead |
| 14 |
memory address that is *not* part of a region and a live memory address that |
| 15 |
*is* within a region. Additionally, it makes computation of region extension or |
| 16 |
offsets easy. `BitIdx` is insufficient to this task, and produces off-by-one |
| 17 |
errors when used in its stead. |
| 18 |
|
| 19 |
## Type Parameters |
| 20 |
|
| 21 |
- `R`: The register element that this dead-bit index governs. |
| 22 |
|
| 23 |
## Validity |
| 24 |
|
| 25 |
Values of this type are **required** to be in the range `0 ..= R::BITS`. Any |
| 26 |
value greater than [`R::BITS`] makes the program invalid and will likely cause |
| 27 |
either a crash or incorrect memory access. |
| 28 |
|
| 29 |
## Construction |
| 30 |
|
| 31 |
This type cannot be publicly constructed except by using the iterators provided |
| 32 |
for testing. |
| 33 |
|
| 34 |
[`BitIdx`]: crate::index::BitIdx |
| 35 |
[`R::BITS`]: funty::Integral::BITS |