enumstd.zig.Zir.Inst.Index[src]

The position of a ZIR instruction within the Zir instructions array.

Fields

main_struct_inst = 0

ZIR is structured so that the outermost "main" struct of any file is always at index 0.

ref_start_index = static_len
_

Values

Constantstatic_len[src]

Source Code

Source code
pub const static_len = 93

Functions

FunctiontoRef[src]

pub fn toRef(i: Index) Inst.Ref

Parameters

Source Code

Source code
pub fn toRef(i: Index) Inst.Ref {
    return @enumFromInt(@intFromEnum(Index.ref_start_index) + @intFromEnum(i));
}

FunctiontoOptional[src]

pub fn toOptional(i: Index) OptionalIndex

Parameters

Source Code

Source code
pub fn toOptional(i: Index) OptionalIndex {
    return @enumFromInt(@intFromEnum(i));
}

Source Code

Source code
pub const Index = enum(u32) {
    /// ZIR is structured so that the outermost "main" struct of any file
    /// is always at index 0.
    main_struct_inst = 0,
    ref_start_index = static_len,
    _,

    pub const static_len = 93;

    pub fn toRef(i: Index) Inst.Ref {
        return @enumFromInt(@intFromEnum(Index.ref_start_index) + @intFromEnum(i));
    }

    pub fn toOptional(i: Index) OptionalIndex {
        return @enumFromInt(@intFromEnum(i));
    }
}