DoxigAlpha

Function parameters

Parameters

#
removed_slot:usize
header:*IndexHeader
I:type
indexes:[]Index(I)

Type definitions in this namespace

Types

#

An `ArrayHashMap` with default hash and equal functions.

Functions

#
AutoArrayHashMap
An `ArrayHashMap` with default hash and equal functions.
AutoArrayHashMapUnmanaged
An `ArrayHashMapUnmanaged` with default hash and equal functions.
StringArrayHashMap
An `ArrayHashMap` with strings as keys.
StringArrayHashMapUnmanaged
An `ArrayHashMapUnmanaged` with strings as keys.
ArrayHashMap
Deprecated in favor of `ArrayHashMapWithAllocator` (no code changes needed)
ArrayHashMapWithAllocator
A hash table of keys and values, each stored sequentially.
ArrayHashMapUnmanaged
A hash table of keys and values, each stored sequentially.

Source

Implementation

#
fn removeSlot(removed_slot: usize, header: *IndexHeader, comptime I: type, indexes: []Index(I)) void {
    const start_index = removed_slot +% 1;
    const end_index = start_index +% indexes.len;

    var last_slot = removed_slot;
    var index: usize = start_index;
    while (index != end_index) : (index +%= 1) {
        const slot = header.constrainIndex(index);
        const slot_data = indexes[slot];
        if (slot_data.isEmpty() or slot_data.distance_from_start_index == 0) {
            indexes[last_slot].setEmpty();
            return;
        }
        indexes[last_slot] = .{
            .entry_index = slot_data.entry_index,
            .distance_from_start_index = slot_data.distance_from_start_index - 1,
        };
        last_slot = slot;
    }
    unreachable;
}