Type Function StaticBitSet [src]

Returns the optimal static bit set type for the specified number of elements: either IntegerBitSet or ArrayBitSet, both of which fulfill the same interface. The returned type will perform no allocations, can be copied by value, and does not require deinitialization.

Prototype

pub fn StaticBitSet(comptime size: usize) type

Parameters

size: usize

Example

test StaticBitSet { try testing.expectEqual(IntegerBitSet(0), StaticBitSet(0)); try testing.expectEqual(IntegerBitSet(5), StaticBitSet(5)); try testing.expectEqual(IntegerBitSet(@bitSizeOf(usize)), StaticBitSet(@bitSizeOf(usize))); try testing.expectEqual(ArrayBitSet(usize, @bitSizeOf(usize) + 1), StaticBitSet(@bitSizeOf(usize) + 1)); try testing.expectEqual(ArrayBitSet(usize, 500), StaticBitSet(500)); }

Source

pub fn StaticBitSet(comptime size: usize) type { if (size <= @bitSizeOf(usize)) { return IntegerBitSet(size); } else { return ArrayBitSet(usize, size); } }