DoxigAlpha

bitSet

Marked inline so that if bit is comptime-known, the instruction can be lowered to a more efficient machine code instruction if possible.

Function parameters

Parameters

#
self:*Self

Functions in this namespace

Functions

#
spinLoopHint
Signals to the processor that the caller is inside a busy-wait spin-loop.

The estimated size of the CPU's cache line when atomically updating memory.

Values

#
cache_line
The estimated size of the CPU's cache line when atomically updating memory.

Source

Implementation

#
pub inline fn bitSet(self: *Self, bit: Bit, comptime order: AtomicOrder) u1 {
    const mask = @as(T, 1) << bit;
    const value = self.fetchOr(mask, order);
    return @intFromBool(value & mask != 0);
}