using System.ComponentModel; using System.Diagnostics; using System.Runtime.CompilerServices; using ComputeSharp.Win32; namespace ComputeSharp.D2D1.Extensions; /// /// Helper methods to efficiently throw exceptions. /// /// Trimmed down version of the same file in ComputeSharp. [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) { default(Win32Exception).ThrowIfFailed((int)result); } /// /// Throws a if represents an error. /// /// The input to check. /// Thrown if represents an error. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Assert(this int result) { default(Win32Exception).ThrowIfFailed(result); } }