Skip to content

Commit 735a5f7

Browse files
bhatnagarsidSiddhant Bhatnagar
andauthored
Workaround for UWP native build (#2369)
* start of workaround for UWP native build * Bool32: Add explicit backing field Add explicit backing field avoiding use of auto-implemented properties due to issues with UWP native toolchain. --------- Co-authored-by: Siddhant Bhatnagar <[email protected]>
1 parent 4feffc7 commit 735a5f7

File tree

1 file changed

+7
-5
lines changed
  • src/Core/Silk.NET.Core/Miscellaneous

1 file changed

+7
-5
lines changed

src/Core/Silk.NET.Core/Miscellaneous/Bool32.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ namespace Silk.NET.Core
1010
/// </summary>
1111
public readonly struct Bool32 : IEquatable<Bool32>, IEquatable<uint>, IEquatable<bool>
1212
{
13+
private readonly uint _value;
14+
1315
/// <summary>
1416
/// Gets the 32-bit value for this boolean.
1517
/// </summary>
16-
public uint Value { get; }
18+
public uint Value { get => _value; }
1719

1820
/// <summary>
1921
/// Returns the hash code for this instance.
@@ -63,27 +65,27 @@ public override int GetHashCode()
6365
/// Creates a 32-bit boolean from the given 32-bit unsigned integer.
6466
/// </summary>
6567
/// <param name="val">The 32-bit unsigned integer value.</param>
66-
public Bool32(uint val) => Value = val;
68+
public Bool32(uint val) => _value = val;
6769

6870
/// <summary>
6971
/// Creates a 32-bit boolean from the given managed boolean.
7072
/// </summary>
7173
/// <param name="val">The boolean value.</param>
72-
public Bool32(bool val) => Value = val ? 1u : 0u;
74+
public Bool32(bool val) => _value = val ? 1u : 0u;
7375

7476
/// <summary>
7577
/// Converts this 32-bit boolean to a managed boolean.
7678
/// </summary>
7779
/// <param name="val">The 32-bit boolean.</param>
7880
/// <returns>The managed boolean.</returns>
79-
public static implicit operator bool(Bool32 val) => val.Value == 1;
81+
public static implicit operator bool(Bool32 val) => val._value == 1;
8082

8183
/// <summary>
8284
/// Converts this 32-bit boolean to a 32-bit unsigned integer.
8385
/// </summary>
8486
/// <param name="val">The 32-bit boolean.</param>
8587
/// <returns>The 32-bit unsigned integer.</returns>
86-
public static implicit operator uint(Bool32 val) => val.Value;
88+
public static implicit operator uint(Bool32 val) => val._value;
8789

8890
/// <summary>
8991
/// Creates a 32-bit boolean from the given managed boolean.

0 commit comments

Comments
 (0)