Function extractElement [src]
Prototype
pub fn extractElement( self: *WipFunction, val: Value, index: Value, name: []const u8, ) Allocator.Error!Value
Parameters
self: *WipFunction
val: Value
index: Value
name: []const u8
Source
pub fn extractElement(
self: *WipFunction,
val: Value,
index: Value,
name: []const u8,
) Allocator.Error!Value {
assert(val.typeOfWip(self).isVector(self.builder));
assert(index.typeOfWip(self).isInteger(self.builder));
try self.ensureUnusedExtraCapacity(1, Instruction.ExtractElement, 0);
const instruction = try self.addInst(name, .{
.tag = .extractelement,
.data = self.addExtraAssumeCapacity(Instruction.ExtractElement{
.val = val,
.index = index,
}),
});
return instruction.toValue();
}