Add bool bitwise operators to Bool type

このコミットが含まれているのは:
Sergio Pedri committed 2022-08-25 03:29:59 +02:00
1 親 b2180713fc
コミット dbd7fc092e
1ファイル変更
+33 -6
+33 -6
ファイルの表示
@@ -56,6 +56,39 @@ public readonly struct Bool
}
#endif
/// <summary>
/// Inverts the <see cref="bool"/> value represented by a given <see cref="Bool"/> instance.
/// </summary>
/// <param name="x">The input <see cref="Bool"/> instance.</param>
public static Bool operator !(Bool x) => new(!x.Value);
/// <summary>
/// Ands two <see cref="Bool"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool"/> value to and.</param>
/// <param name="right">The <see cref="Bool"/> value to combine.</param>
/// <returns>The result of performing the bitwise and between <paramref name="left"/> and <paramref name="right"/>.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static Bool operator &(Bool left, Bool right) => default;
/// <summary>
/// Ors two <see cref="Bool"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool"/> value to or.</param>
/// <param name="right">The <see cref="Bool"/> value to combine.</param>
/// <returns>The result of performing the or between <paramref name="left"/> and <paramref name="right"/>.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static Bool operator |(Bool left, Bool right) => default;
/// <summary>
/// Xors two <see cref="Bool"/> values.
/// </summary>
/// <param name="left">The <see cref="Bool"/> value to xor.</param>
/// <param name="right">The <see cref="Bool"/> value to combine.</param>
/// <returns>The result of performing the xor between <paramref name="left"/> and <paramref name="right"/>.</returns>
/// <remarks>This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior.</remarks>
public static Bool operator ^(Bool left, Bool right) => default;
/// <summary>
/// Checks whether or not two <see cref="Bool"/> instances represent the same <see cref="bool"/> value.
/// </summary>
@@ -70,12 +103,6 @@ public readonly struct Bool
/// <param name="right">The right <see cref="Bool"/> instance.</param>
public static bool operator !=(Bool left, Bool right) => left.Value != right.Value;
/// <summary>
/// Inverts the <see cref="bool"/> value represented by a given <see cref="Bool"/> instance.
/// </summary>
/// <param name="x">The input <see cref="Bool"/> instance.</param>
public static Bool operator !(Bool x) => new(!x.Value);
/// <summary>
/// Converts a given <see cref="Bool"/> instance to its corresponding <see cref="bool"/> value.
/// </summary>