diff --git a/Microsoft.Toolkit.HighPerformance/Helpers/BitHelper.cs b/Microsoft.Toolkit.HighPerformance/Helpers/BitHelper.cs
index 2e72020f..eabce3cb 100644
--- a/Microsoft.Toolkit.HighPerformance/Helpers/BitHelper.cs
+++ b/Microsoft.Toolkit.HighPerformance/Helpers/BitHelper.cs
@@ -134,6 +134,37 @@ namespace Microsoft.Toolkit.HighPerformance.Helpers
return ((value - 0x0101_0101_0101_0101ul) & ~value & 0x8080_8080_8080_8080ul) != 0;
}
+ ///
+ /// Checks whether a byte in the input value matches a target value.
+ ///
+ /// The input value to check.
+ /// The target byte to look for.
+ /// Whether has any bytes set to .
+ ///
+ /// This method contains no branches.
+ /// For more info, see .
+ ///
+ [Pure]
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool HasByteEqualTo(uint value, byte target)
+ {
+ return HasZeroByte(value ^ (0x0101_0101u * target));
+ }
+
+ ///
+ /// Checks whether a byte in the input value matches a target value.
+ /// This method mirrors , but with values.
+ ///
+ /// The input value to check.
+ /// The target byte to look for.
+ /// Whether has any bytes set to .
+ [Pure]
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool HasByteEqualTo(ulong value, byte target)
+ {
+ return HasZeroByte(value ^ (0x0101_0101_0101_0101u * target));
+ }
+
///
/// Sets a bit to a specified value.
///