Skip to content

Commit

Permalink
Adding some implicit conversion operators for LARGE_INTEGER and ULARG…
Browse files Browse the repository at this point in the history
…E_INTEGER
  • Loading branch information
tannergooding committed Dec 23, 2021
1 parent f5ca0d7 commit 25da5d5
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
20 changes: 20 additions & 0 deletions sources/Interop/Windows/Windows/um/winnt/LARGE_INTEGER.Manual.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.

// Ported from um/winnt.h in the Windows SDK for Windows 10.0.20348.0
// Original source is Copyright © Microsoft. All rights reserved.

using System.Runtime.CompilerServices;

namespace TerraFX.Interop.Windows;

public partial struct LARGE_INTEGER
{
public static implicit operator long(LARGE_INTEGER value) => value.QuadPart;

public static implicit operator LARGE_INTEGER(long value)
{
Unsafe.SkipInit(out LARGE_INTEGER result);
result.QuadPart = value;
return result;
}
}
20 changes: 20 additions & 0 deletions sources/Interop/Windows/Windows/um/winnt/ULARGE_INTEGER.Manual.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.

// Ported from um/winnt.h in the Windows SDK for Windows 10.0.20348.0
// Original source is Copyright © Microsoft. All rights reserved.

using System.Runtime.CompilerServices;

namespace TerraFX.Interop.Windows;

public partial struct ULARGE_INTEGER
{
public static implicit operator ulong(ULARGE_INTEGER value) => value.QuadPart;

public static implicit operator ULARGE_INTEGER(ulong value)
{
Unsafe.SkipInit(out ULARGE_INTEGER result);
result.QuadPart = value;
return result;
}
}

0 comments on commit 25da5d5

Please sign in to comment.