fn Index(comptime I: type) type entry_index: IThe index of this entry in the backing store. If the index is empty, this is empty_sentinel.
distance_from_start_index: IThe distance between this slot and its ideal placement. This is used to keep maximum scan length small. This value is undefined if the index is empty.
The special entry_index value marking an empty slot.
A constant empty index
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615fn Index(comptime I: type) type {
return extern struct {
const Self = @This();
/// The index of this entry in the backing store. If the index is
/// empty, this is empty_sentinel.
entry_index: I,
/// The distance between this slot and its ideal placement. This is
/// used to keep maximum scan length small. This value is undefined
/// if the index is empty.
distance_from_start_index: I,
/// The special entry_index value marking an empty slot.
const empty_sentinel = ~@as(I, 0);
/// A constant empty index
const empty = Self{
.entry_index = empty_sentinel,
.distance_from_start_index = undefined,
};
/// Checks if a slot is empty
fn isEmpty(idx: Self) bool {
return idx.entry_index == empty_sentinel;
}
/// Sets a slot to empty
fn setEmpty(idx: *Self) void {
idx.entry_index = empty_sentinel;
idx.distance_from_start_index = undefined;
}
};
}
A single entry in the lookup acceleration structure. These structs are found in an array after the IndexHeader. Hashes index into this array, and linear probing is used for collisions.