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