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