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 long3 : IBinaryNumber<long3>
|
|
{
|
|
/// <summary>Determines if every component of a value is a power of two.</summary>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
static bool IBinaryNumber<long3>.IsPow2(long3 value)
|
|
{
|
|
return long.IsPow2(value.X) && long.IsPow2(value.Y) && long.IsPow2(value.Z);
|
|
}
|
|
|
|
/// <inheritdoc cref="IBinaryNumber{TSelf}.Log2" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static long3 Log2(long3 value)
|
|
{
|
|
return new long3(long.Log2(value.X), long.Log2(value.Y), long.Log2(value.Z));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static long3 operator &(long3 a, long3 b)
|
|
{
|
|
return new(a.X & b.X, a.Y & b.Y, a.Z & b.Z);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static long3 operator |(long3 a, long3 b)
|
|
{
|
|
return new(a.X | b.X, a.Y | b.Y, a.Z | b.Z);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static long3 operator ^(long3 a, long3 b)
|
|
{
|
|
return new(a.X ^ b.X, a.Y ^ b.Y, a.Z ^ b.Z);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static long3 operator ~(long3 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 long3
|
|
{
|
|
/// <summary>Determines which components of a value are powers of two.</summary>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static bool3 IsPow2(long3 value)
|
|
{
|
|
return new bool3(long.IsPow2(value.X), long.IsPow2(value.Y), long.IsPow2(value.Z));
|
|
}
|
|
}
|
|
|
|
// the good bits from IBinaryInteger - declared on IIntegerVector
|
|
public partial struct long3
|
|
{
|
|
/// <inheritdoc cref="IBinaryInteger{TSelf}.PopCount" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static long3 PopCount(long3 value)
|
|
{
|
|
return new long3(long.PopCount(value.X), long.PopCount(value.Y), long.PopCount(value.Z));
|
|
}
|
|
|
|
/// <inheritdoc cref="IBinaryInteger{TSelf}.LeadingZeroCount" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static long3 LeadingZeroCount(long3 value)
|
|
{
|
|
return new long3(long.LeadingZeroCount(value.X), long.LeadingZeroCount(value.Y), long.LeadingZeroCount(value.Z));
|
|
}
|
|
|
|
/// <inheritdoc cref="IBinaryInteger{TSelf}.TrailingZeroCount" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static long3 TrailingZeroCount(long3 value)
|
|
{
|
|
return new long3(long.TrailingZeroCount(value.X), long.TrailingZeroCount(value.Y), long.TrailingZeroCount(value.Z));
|
|
}
|
|
|
|
/// <inheritdoc cref="IBinaryInteger{TSelf}.RotateLeft" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static long3 RotateLeft(long3 value, int rotateAmount)
|
|
{
|
|
return new long3(long.RotateLeft(value.X, rotateAmount), long.RotateLeft(value.Y, rotateAmount), long.RotateLeft(value.Z, rotateAmount));
|
|
}
|
|
|
|
/// <inheritdoc cref="IBinaryInteger{TSelf}.RotateRight" />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static long3 RotateRight(long3 value, int rotateAmount)
|
|
{
|
|
return new long3(long.RotateRight(value.X, rotateAmount), long.RotateRight(value.Y, rotateAmount), long.RotateRight(value.Z, rotateAmount));
|
|
}
|
|
}
|