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