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 › fp128ConstAssumeCapacity Private Function fp128ConstAssumeCapacity Doc Source Private Function std.zig.llvm.Builder.fp128ConstAssumeCapacity
fn fp128ConstAssumeCapacity (self : *Builder , val : f128 ) Constant Params File zig/llvm/Builder.zig: 12413
12413
12414
12415
12416
12417
12418
12419
12420
12421
12422
12423
12424
12425
12426
12427
12428
12429
12430
12431
12432
12433
12434
12435
12436
12437
12438
12439
12440
12441
12442
12443
12444
12445 fn fp128ConstAssumeCapacity (self : *Builder , val : f128 ) Constant {
const Adapter = struct {
builder : *const Builder ,
pub fn hash (_ : @This (), key : f128 ) u32 {
return @truncate (std .hash .Wyhash .hash (
comptime std .hash .int (@backingInt (Constant .Tag .fp128 )),
std .mem .asBytes (&key ),
));
}
pub fn eql (ctx : @This (), lhs_key : f128 , _ : void , rhs_index : usize ) bool {
if (ctx .builder .constant_items .items (.tag )[rhs_index ] != .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 (u128 , @bitCast (lhs_key )) == @as (u128 , rhs_extra .hi_hi ) << 96 |
@as (u128 , rhs_extra .hi_lo ) << 64 | @as (u128 , rhs_extra .lo_hi ) << 32 | rhs_extra .lo_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 = .fp128 ,
.data = self .addConstantExtraAssumeCapacity (Constant .Fp128 {
.lo_lo = @truncate (@as (u128 , @bitCast (val ))),
.lo_hi = @truncate (@as (u128 , @bitCast (val )) >> 32 ),
.hi_lo = @truncate (@as (u128 , @bitCast (val )) >> 64 ),
.hi_hi = @intCast (@as (u128 , @bitCast (val )) >> 96 ),
}),
});
}
return @fromBackingInt (@intCast (gop .index ));
}