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