File: src\runtime\src\libraries\Common\src\Interop\Windows\Interop.HRESULT_FROM_WIN32.cs
Web Access
Project: System.Net.Http.WinHttpHandler.csproj (System.Net.Http.WinHttpHandler)
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Runtime.CompilerServices;

internal static partial class Interop
{
    // Implementation of HRESULT_FROM_WIN32 macro
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    internal static int HRESULT_FROM_WIN32(int errorCode)
    {
        if ((errorCode & 0x80000000) == 0x80000000)
        {
            return errorCode;
        }

        return (errorCode & 0x0000FFFF) | unchecked((int)0x80070000);
    }
}