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 › bit_set › Integer › setRangeValue Public Function setRangeValue Doc Source Public Function std.bit_set.Integer.setRangeValue
pub fn setRangeValue (self : *Self , range : Range , value : bool ) void Params File bit_set.zig: 118
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139 pub fn setRangeValue (self : *Self , range : Range , value : bool ) void {
assert (range .end <= bit_length );
assert (range .start <= range .end );
if (range .start == range .end ) return ;
if (MaskInt == u0 ) return ;
const start_bit = @as (ShiftInt , @intCast (range .start ));
var mask = std .math .boolMask (MaskInt , true ) << start_bit ;
if (range .end != bit_length ) {
const end_bit = @as (ShiftInt , @intCast (range .end ));
mask &= std .math .boolMask (MaskInt , true ) >> @as (ShiftInt , @truncate (@as (usize , @bitSizeOf (MaskInt )) - @as (usize , end_bit )));
}
self .mask &= ~mask ;
mask = std .math .boolMask (MaskInt , value ) << start_bit ;
if (range .end != bit_length ) {
const end_bit = @as (ShiftInt , @intCast (range .end ));
mask &= std .math .boolMask (MaskInt , value ) >> @as (ShiftInt , @truncate (@as (usize , @bitSizeOf (MaskInt )) - @as (usize , end_bit )));
}
self .mask |= mask ;
}
Changes the value of all bits in the specified range to match the passed boolean.