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