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