A bit manipulation readability enhancement library.
For any given number return the number if it’s a power of two, or return the next higher power of two capable of fitting in the data type.
public static ushort RoundUpToPowerOfTwo(this ushort number);
number
System.UInt16
The number to evaluate.
ushort v = 2;
Console.WriteLine($"{v.RoundUpToPowerOfTwo()}"); // outputs: 2
v = 3;
Console.WriteLine($"{v.RoundUpToPowerOfTwo()}"); // outputs: 4