mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 12:38: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 uint4 : IBinaryNumber<uint4>
|
|
{
|
|
/// <summary>Determines if every component of a value is a power of two.</summary>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
static bool IBinaryNumber<uint4>.IsPow2(uint4 value)
|
|
{
|
|
return uint.IsPow2(value.X) && uint.IsPow2(value.Y) && uint.IsPow2(value.Z) && uint.IsPow2(value.W);
|
|
}
|
|
|
|
/// <inheritdoc cref="IBinaryNumber{TSelf}.Log2" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static uint4 Log2(uint4 value)
|
|
{
|
|
return new uint4(uint.Log2(value.X), uint.Log2(value.Y), uint.Log2(value.Z), uint.Log2(value.W));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static uint4 operator &(uint4 a, uint4 b)
|
|
{
|
|
return new(a.X & b.X, a.Y & b.Y, a.Z & b.Z, a.W & b.W);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static uint4 operator |(uint4 a, uint4 b)
|
|
{
|
|
return new(a.X | b.X, a.Y | b.Y, a.Z | b.Z, a.W | b.W);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static uint4 operator ^(uint4 a, uint4 b)
|
|
{
|
|
return new(a.X ^ b.X, a.Y ^ b.Y, a.Z ^ b.Z, a.W ^ b.W);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static uint4 operator ~(uint4 value)
|
|
{
|
|
return new(~value.X, ~value.Y, ~value.Z, ~value.W);
|
|
}
|
|
}
|
|
|
|
// the componentwise predicate mask (no interface to mirror) - the per-lane truth IsPow2 collapses
|
|
public partial struct uint4
|
|
{
|
|
/// <summary>Determines which components of a value are powers of two.</summary>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static bool4 IsPow2(uint4 value)
|
|
{
|
|
return new bool4(uint.IsPow2(value.X), uint.IsPow2(value.Y), uint.IsPow2(value.Z), uint.IsPow2(value.W));
|
|
}
|
|
}
|
|
|
|
// the good bits from IBinaryInteger - declared on IIntegerVector
|
|
public partial struct uint4
|
|
{
|
|
/// <inheritdoc cref="IBinaryInteger{TSelf}.PopCount" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static uint4 PopCount(uint4 value)
|
|
{
|
|
return new uint4(uint.PopCount(value.X), uint.PopCount(value.Y), uint.PopCount(value.Z), uint.PopCount(value.W));
|
|
}
|
|
|
|
/// <inheritdoc cref="IBinaryInteger{TSelf}.LeadingZeroCount" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static uint4 LeadingZeroCount(uint4 value)
|
|
{
|
|
return new uint4(uint.LeadingZeroCount(value.X), uint.LeadingZeroCount(value.Y), uint.LeadingZeroCount(value.Z), uint.LeadingZeroCount(value.W));
|
|
}
|
|
|
|
/// <inheritdoc cref="IBinaryInteger{TSelf}.TrailingZeroCount" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static uint4 TrailingZeroCount(uint4 value)
|
|
{
|
|
return new uint4(uint.TrailingZeroCount(value.X), uint.TrailingZeroCount(value.Y), uint.TrailingZeroCount(value.Z), uint.TrailingZeroCount(value.W));
|
|
}
|
|
|
|
/// <inheritdoc cref="IBinaryInteger{TSelf}.RotateLeft" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static uint4 RotateLeft(uint4 value, int rotateAmount)
|
|
{
|
|
return new uint4(uint.RotateLeft(value.X, rotateAmount), uint.RotateLeft(value.Y, rotateAmount), uint.RotateLeft(value.Z, rotateAmount), uint.RotateLeft(value.W, rotateAmount));
|
|
}
|
|
|
|
/// <inheritdoc cref="IBinaryInteger{TSelf}.RotateRight" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static uint4 RotateRight(uint4 value, int rotateAmount)
|
|
{
|
|
return new uint4(uint.RotateRight(value.X, rotateAmount), uint.RotateRight(value.Y, rotateAmount), uint.RotateRight(value.Z, rotateAmount), uint.RotateRight(value.W, rotateAmount));
|
|
}
|
|
}
|