Zig 0.17.0-dev (Split by item) 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.
std › zig › llvm › Builder › ppc_fp128ConstAssumeCapacity Private Function ppc_fp128ConstAssumeCapacity Doc Source Private Function std.zig.llvm.Builder.ppc_fp128ConstAssumeCapacity
fn ppc_fp128ConstAssumeCapacity (self : *Builder , val : [2 ]f64 ) Constant Params File zig/llvm/Builder.zig: 12480
12480
12481
12482
12483
12484
12485
12486
12487
12488
12489
12490
12491
12492
12493
12494
12495
12496
12497
12498
12499
12500
12501
12502
12503
12504
12505
12506
12507
12508
12509
12510
12511
12512 fn ppc_fp128ConstAssumeCapacity (self : *Builder , val : [2 ]f64 ) Constant {
const Adapter = struct {
builder : *const Builder ,
pub fn hash (_ : @This (), key : [2 ]f64 ) u32 {
return @truncate (std .hash .Wyhash .hash (
comptime std .hash .int (@backingInt (Constant .Tag .ppc_fp128 )),
std .mem .asBytes (&key ),
));
}
pub fn eql (ctx : @This (), lhs_key : [2 ]f64 , _ : void , rhs_index : usize ) bool {
if (ctx .builder .constant_items .items (.tag )[rhs_index ] != .ppc_fp128 ) return false ;
const rhs_data = ctx .builder .constant_items .items (.data )[rhs_index ];
const rhs_extra = ctx .builder .constantExtraData (Constant .Fp128 , rhs_data );
return @as (u64 , @bitCast (lhs_key [0 ])) == @as (u64 , rhs_extra .lo_hi ) << 32 | rhs_extra .lo_lo and
@as (u64 , @bitCast (lhs_key [1 ])) == @as (u64 , rhs_extra .hi_hi ) << 32 | rhs_extra .hi_lo ;
}
};
const gop = self .constant_map .getOrPutAssumeCapacityAdapted (val , Adapter { .builder = self });
if (!gop .found_existing ) {
gop .key_ptr .* = {};
gop .value_ptr .* = {};
self .constant_items .appendAssumeCapacity (.{
.tag = .ppc_fp128 ,
.data = self .addConstantExtraAssumeCapacity (Constant .Fp128 {
.lo_lo = @truncate (@as (u64 , @bitCast (val [0 ]))),
.lo_hi = @intCast (@as (u64 , @bitCast (val [0 ])) >> 32 ),
.hi_lo = @truncate (@as (u64 , @bitCast (val [1 ]))),
.hi_hi = @intCast (@as (u64 , @bitCast (val [1 ])) >> 32 ),
}),
});
}
return @fromBackingInt (@intCast (gop .index ));
}