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