using System.ComponentModel; using System.Diagnostics; using System.Runtime.CompilerServices; using Microsoft.Toolkit.Diagnostics; using HRESULT = System.Int32; namespace ComputeSharp.Core.Extensions { /// /// Helper methods to efficiently throw exceptions. /// [DebuggerStepThrough] internal static class HResultExtensions { /// /// Throws a if represents an error. /// /// The input to check. /// Thrown if represents an error. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Assert(this HRESULT result) { if (result < 0) { ThrowHelper.ThrowWin32Exception(result); } } } }