feature. See also
. The project being documented here (as the example) is the Zig library itself.
AstGen.bitCast
fn bitCast(
gz: *GenZir,
scope: *Scope,
ri: ResultInfo,
node: Ast.Node.Index,
operand_node: Ast.Node.Index,
) InnerError!Zir.Inst.Ref
File
Code
fn bitCast(
gz: *GenZir,
scope: *Scope,
ri: ResultInfo,
node: Ast.Node.Index,
operand_node: Ast.Node.Index,
) InnerError!Zir.Inst.Ref {
const cursor = maybeAdvanceSourceCursorToMainToken(gz, node);
const dest_type = try ri.rl.resultTypeForCast(gz, node, "@bitCast");
const operand = try reachableExpr(gz, scope, .{ .rl = .none }, operand_node, node);
try emitDbgStmt(gz, cursor);
const result = try gz.addPlNode(.bitcast, node, Zir.Inst.Bin{
.lhs = dest_type,
.rhs = operand,
});
return rvalue(gz, ri, result, node);
}