Skip to main content

Class BitMask

Inheritance
System.Object
Inherited Members
Show
Syntax
public static class BitMask

Methods

Mask(Int32)

Creates mask for bits

(showing 32 bits for simplify, result is 64 bit)

Example bits = 4 => mask = 00000000_00000000_00000000_00001111

Example bits = 10 => mask = 00000000_00000000_00000011_11111111

Declaration
public static ulong Mask(int bits)
Parameters
TypeNameDescription
System.Int32bits
Returns
TypeDescription
System.UInt64

OuterMask(Int32, Int32)

Creates Mask either side of start and end Note this mask is only valid for start [0..63] and end [0..64]

Declaration
public static ulong OuterMask(int start, int end)
Parameters
TypeNameDescription
System.Int32start
System.Int32end
Returns
TypeDescription
System.UInt64