Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Private Function

addExtraAssumeCapacity

Private Function
std.zig.llvm.Builder.WipFunction.addExtraAssumeCapacity
fn addExtraAssumeCapacity(self: *WipFunction, extra: anytype) Instruction.ExtraIndex

Params

File

zig/llvm/Builder.zig:8109
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
    fn addExtraAssumeCapacity(self: *WipFunction, extra: anytype) Instruction.ExtraIndex {
        const result: Instruction.ExtraIndex = @intCast(self.extra.items.len);
        const info = @typeInfo(@TypeOf(extra)).@"struct";
        inline for (info.field_names, info.field_types) |field_name, field_type| {
            const value = @field(extra, field_name);
            self.extra.appendAssumeCapacity(switch (field_type) {
                u32 => value,
                Alignment,
                AtomicOrdering,
                Block.Index,
                FunctionAttributes,
                Type,
                Value,
                Instruction.BrCond.Weights,
                => @backingInt(value),
                MemoryAccessInfo,
                Instruction.Alloca.Info,
                Instruction.Call.Info,
                => @bitCast(value),
                else => @compileError("bad field type: " ++ field_name ++ ": " ++ @typeName(field_type)),
            });
        }
        return result;
    }