namespace Brutal.VulkanApi.Abstractions; /// /// Alignment helpers for . /// public static class ByteSizeExtensions { /// /// Round the value up to the next multiple of . /// The alignment must be a power of two; an alignment of zero returns the value unchanged. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ByteSize AlignUp(this ByteSize value, ByteSize alignment) { if (alignment == 0) return value; return ByteSize.Of((value + alignment - 1) & ~(alignment - 1)); } /// /// True when the value is a multiple of (an alignment of zero always matches). /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool IsAlignedTo(this ByteSize value, ByteSize alignment) { return value.AlignUp(alignment) == value; } }