Skip to content
GraphNodeIdGeneration

GraphNodeIdGeneration

Description

Extract the generation encoded in a node id.

Parameters

Name Direction Description
id in Graph node id.

Success

High 32-bit generation encoded in id.

Failure

Function cannot fail.

Usage example (Cross-references)

Usage examples (Cross-references)
    
        index      = GraphNodeIdIndex(node_id);
        generation = GraphNodeIdGeneration(node_id);
    
        if (!generation) {
    
            if (graph_slot_is_occupied(slot) && !graph_slot_is_marked(slot) &&
                (slot->generation == GraphNodeIdGeneration(neighbor_id))) {
                idx += 1;
            } else {
    
        index      = GraphNodeIdIndex(node_id);
        generation = GraphNodeIdGeneration(node_id);
    
        if (!generation || ((u64)index >= VecLen(&graph->slots))) {
    
        bool result = GraphAllocator(&graph)->alignment == 32 && GraphNodeIdIndex(node_id) == 0 &&
                      GraphNodeIdGeneration(node_id) == 1;
        result = result && GraphNodeGetId(node) == node_id;
        result = result && GraphNodeIndex(node) == 0;
    
        result = result && (GraphNodeIdIndex(d) == GraphNodeIdIndex(b));
        result = result && (GraphNodeIdGeneration(d) == (GraphNodeIdGeneration(b) + 1));
        result = result && (GraphNodeData(&graph, GraphGetNode(&graph, d)) == 40);
        result = result && !GraphNodeVisited(GraphGetNode(&graph, d));
    
        result = result && (GraphNodeIdIndex(reused) == GraphNodeIdIndex(b));
        result = result && (GraphNodeIdGeneration(reused) == (GraphNodeIdGeneration(b) + 1));
        result = result && (counts[GraphNodeIdIndex(reused)] == 29);
        u64         slot_count        = VecLen(&graph.slots);
        size        slot_capacity     = VecCapacity(&graph.slots);
        u32         first_generation  = GraphNodeIdGeneration(first_id);
        u32         second_generation = GraphNodeIdGeneration(second_id);
        u32         third_generation  = GraphNodeIdGeneration(third_id);
        size        slot_capacity     = VecCapacity(&graph.slots);
        u32         first_generation  = GraphNodeIdGeneration(first_id);
        u32         second_generation = GraphNodeIdGeneration(second_id);
        u32         third_generation  = GraphNodeIdGeneration(third_id);
        u64         slot_index;
        u32         first_generation  = GraphNodeIdGeneration(first_id);
        u32         second_generation = GraphNodeIdGeneration(second_id);
        u32         third_generation  = GraphNodeIdGeneration(third_id);
        u64         slot_index;
        GraphNodeId id1 = GraphAddNodeR(&graph, shared);
    
        bool result = GraphNodeIdIndex(id0) == 0 && GraphNodeIdGeneration(id0) == 1 && GraphNodeIdIndex(id1) == 1;
        result      = result && owned == 0 && shared == 7;
        result      = result && GraphNodeAt(&graph, id0) == 42;
Last updated on