Skip to content

Commit

Permalink
changes from discussions in microsoft#624
Browse files Browse the repository at this point in the history
  • Loading branch information
elachlan committed Jul 28, 2022
1 parent c3eedf8 commit e4d75ab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
9 changes: 2 additions & 7 deletions src/Microsoft.Windows.CsWin32/templates/BOOL.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
partial struct BOOL
{
internal unsafe BOOL(bool value) => this.Value = value ? 1 : 0;
public static unsafe implicit operator bool(BOOL value)
{
sbyte v = checked((sbyte)value.Value);
return *(bool*)&v;
}

internal BOOL(bool value) => this.Value = value ? 1 : 0;
public static implicit operator bool(BOOL value) => this.value != 0;
public static implicit operator BOOL(bool value) => new BOOL(value);
}
9 changes: 2 additions & 7 deletions src/Microsoft.Windows.CsWin32/templates/BOOLEAN.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
partial struct BOOLEAN
{
internal unsafe BOOLEAN(bool value) => this.Value = value ? 1 : 0;
public static unsafe implicit operator bool(BOOLEAN value)
{
byte v = checked((byte)value.Value);
return *(bool*)&v;
}

internal BOOLEAN(bool value) => this.Value = value ? 1 : 0;
public static implicit operator bool(BOOLEAN value) => this.value != 0;
public static implicit operator BOOLEAN(bool value) => new BOOLEAN(value);
}

0 comments on commit e4d75ab

Please sign in to comment.