mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 20:48:24 +01:00
100 lines
4 KiB
C#
100 lines
4 KiB
C#
// <auto-generated /> - edit Vector.numerics-binary.tt to modify
|
|
#nullable enable
|
|
|
|
namespace Brutal.Numerics;
|
|
|
|
// IBinaryNumber
|
|
public partial struct short4 : IBinaryNumber<short4>
|
|
{
|
|
/// <summary>Determines if every component of a value is a power of two.</summary>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
static bool IBinaryNumber<short4>.IsPow2(short4 value)
|
|
{
|
|
return short.IsPow2(value.X) && short.IsPow2(value.Y) && short.IsPow2(value.Z) && short.IsPow2(value.W);
|
|
}
|
|
|
|
/// <inheritdoc cref="IBinaryNumber{TSelf}.Log2" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static short4 Log2(short4 value)
|
|
{
|
|
return new short4(short.Log2(value.X), short.Log2(value.Y), short.Log2(value.Z), short.Log2(value.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static short4 operator &(short4 a, short4 b)
|
|
{
|
|
return new((short)(a.X & b.X), (short)(a.Y & b.Y), (short)(a.Z & b.Z), (short)(a.W & b.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static short4 operator |(short4 a, short4 b)
|
|
{
|
|
return new((short)(a.X | b.X), (short)(a.Y | b.Y), (short)(a.Z | b.Z), (short)(a.W | b.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static short4 operator ^(short4 a, short4 b)
|
|
{
|
|
return new((short)(a.X ^ b.X), (short)(a.Y ^ b.Y), (short)(a.Z ^ b.Z), (short)(a.W ^ b.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static short4 operator ~(short4 value)
|
|
{
|
|
return new((short)(~value.X), (short)(~value.Y), (short)(~value.Z), (short)(~value.W));
|
|
}
|
|
}
|
|
|
|
// the componentwise predicate mask (no interface to mirror) - the per-lane truth IsPow2 collapses
|
|
public partial struct short4
|
|
{
|
|
/// <summary>Determines which components of a value are powers of two.</summary>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static bool4 IsPow2(short4 value)
|
|
{
|
|
return new bool4(short.IsPow2(value.X), short.IsPow2(value.Y), short.IsPow2(value.Z), short.IsPow2(value.W));
|
|
}
|
|
}
|
|
|
|
// the good bits from IBinaryInteger - declared on IIntegerVector
|
|
public partial struct short4
|
|
{
|
|
/// <inheritdoc cref="IBinaryInteger{TSelf}.PopCount" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static short4 PopCount(short4 value)
|
|
{
|
|
return new short4(short.PopCount(value.X), short.PopCount(value.Y), short.PopCount(value.Z), short.PopCount(value.W));
|
|
}
|
|
|
|
/// <inheritdoc cref="IBinaryInteger{TSelf}.LeadingZeroCount" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static short4 LeadingZeroCount(short4 value)
|
|
{
|
|
return new short4(short.LeadingZeroCount(value.X), short.LeadingZeroCount(value.Y), short.LeadingZeroCount(value.Z), short.LeadingZeroCount(value.W));
|
|
}
|
|
|
|
/// <inheritdoc cref="IBinaryInteger{TSelf}.TrailingZeroCount" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static short4 TrailingZeroCount(short4 value)
|
|
{
|
|
return new short4(short.TrailingZeroCount(value.X), short.TrailingZeroCount(value.Y), short.TrailingZeroCount(value.Z), short.TrailingZeroCount(value.W));
|
|
}
|
|
|
|
/// <inheritdoc cref="IBinaryInteger{TSelf}.RotateLeft" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static short4 RotateLeft(short4 value, int rotateAmount)
|
|
{
|
|
return new short4(short.RotateLeft(value.X, rotateAmount), short.RotateLeft(value.Y, rotateAmount), short.RotateLeft(value.Z, rotateAmount), short.RotateLeft(value.W, rotateAmount));
|
|
}
|
|
|
|
/// <inheritdoc cref="IBinaryInteger{TSelf}.RotateRight" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static short4 RotateRight(short4 value, int rotateAmount)
|
|
{
|
|
return new short4(short.RotateRight(value.X, rotateAmount), short.RotateRight(value.Y, rotateAmount), short.RotateRight(value.Z, rotateAmount), short.RotateRight(value.W, rotateAmount));
|
|
}
|
|
}
|