static int GetCapacityMask(int spanLength) { return((1 << SpanHelper.GetPowerOf2(spanLength)) - 1); }
static void ValidateSpanCapacity(ref TSpan span, int capacityMask) { Debug.Assert((1 << SpanHelper.GetPowerOf2(span.Length)) - 1 == capacityMask, "Capacity mask should be the largest power of 2 that fits in the allocated span, minus one. This is necessary for efficient modulo operations."); }