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