// - edit Vector.numerics-binary.tt to modify
#nullable enable
namespace Brutal.Numerics;
// IBinaryNumber
public partial struct sbyte4 : IBinaryNumber
{
/// Determines if every component of a value is a power of two.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static bool IBinaryNumber.IsPow2(sbyte4 value)
{
return sbyte.IsPow2(value.X) && sbyte.IsPow2(value.Y) && sbyte.IsPow2(value.Z) && sbyte.IsPow2(value.W);
}
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static sbyte4 Log2(sbyte4 value)
{
return new sbyte4(sbyte.Log2(value.X), sbyte.Log2(value.Y), sbyte.Log2(value.Z), sbyte.Log2(value.W));
}
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static sbyte4 operator &(sbyte4 a, sbyte4 b)
{
return new((sbyte)(a.X & b.X), (sbyte)(a.Y & b.Y), (sbyte)(a.Z & b.Z), (sbyte)(a.W & b.W));
}
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static sbyte4 operator |(sbyte4 a, sbyte4 b)
{
return new((sbyte)(a.X | b.X), (sbyte)(a.Y | b.Y), (sbyte)(a.Z | b.Z), (sbyte)(a.W | b.W));
}
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static sbyte4 operator ^(sbyte4 a, sbyte4 b)
{
return new((sbyte)(a.X ^ b.X), (sbyte)(a.Y ^ b.Y), (sbyte)(a.Z ^ b.Z), (sbyte)(a.W ^ b.W));
}
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static sbyte4 operator ~(sbyte4 value)
{
return new((sbyte)(~value.X), (sbyte)(~value.Y), (sbyte)(~value.Z), (sbyte)(~value.W));
}
}
// the componentwise predicate mask (no interface to mirror) - the per-lane truth IsPow2 collapses
public partial struct sbyte4
{
/// Determines which components of a value are powers of two.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool4 IsPow2(sbyte4 value)
{
return new bool4(sbyte.IsPow2(value.X), sbyte.IsPow2(value.Y), sbyte.IsPow2(value.Z), sbyte.IsPow2(value.W));
}
}
// the good bits from IBinaryInteger - declared on IIntegerVector
public partial struct sbyte4
{
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static sbyte4 PopCount(sbyte4 value)
{
return new sbyte4(sbyte.PopCount(value.X), sbyte.PopCount(value.Y), sbyte.PopCount(value.Z), sbyte.PopCount(value.W));
}
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static sbyte4 LeadingZeroCount(sbyte4 value)
{
return new sbyte4(sbyte.LeadingZeroCount(value.X), sbyte.LeadingZeroCount(value.Y), sbyte.LeadingZeroCount(value.Z), sbyte.LeadingZeroCount(value.W));
}
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static sbyte4 TrailingZeroCount(sbyte4 value)
{
return new sbyte4(sbyte.TrailingZeroCount(value.X), sbyte.TrailingZeroCount(value.Y), sbyte.TrailingZeroCount(value.Z), sbyte.TrailingZeroCount(value.W));
}
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static sbyte4 RotateLeft(sbyte4 value, int rotateAmount)
{
return new sbyte4(sbyte.RotateLeft(value.X, rotateAmount), sbyte.RotateLeft(value.Y, rotateAmount), sbyte.RotateLeft(value.Z, rotateAmount), sbyte.RotateLeft(value.W, rotateAmount));
}
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static sbyte4 RotateRight(sbyte4 value, int rotateAmount)
{
return new sbyte4(sbyte.RotateRight(value.X, rotateAmount), sbyte.RotateRight(value.Y, rotateAmount), sbyte.RotateRight(value.Z, rotateAmount), sbyte.RotateRight(value.W, rotateAmount));
}
}