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