mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-26 13:08:24 +01:00
first
This commit is contained in:
parent
bd62d51ec9
commit
b578433e37
1 changed files with 784842 additions and 0 deletions
100
Brutal.Numerics/Vector/int4/int4.numerics-binary.gen.cs
Normal file
100
Brutal.Numerics/Vector/int4/int4.numerics-binary.gen.cs
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
// <auto-generated /> - edit Vector.numerics-binary.tt to modify
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.Numerics;
|
||||
|
||||
// IBinaryNumber
|
||||
public partial struct int4 : IBinaryNumber<int4>
|
||||
{
|
||||
/// <summary>Determines if every component of a value is a power of two.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
static bool IBinaryNumber<int4>.IsPow2(int4 value)
|
||||
{
|
||||
return int.IsPow2(value.X) && int.IsPow2(value.Y) && int.IsPow2(value.Z) && int.IsPow2(value.W);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IBinaryNumber{TSelf}.Log2" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static int4 Log2(int4 value)
|
||||
{
|
||||
return new int4(int.Log2(value.X), int.Log2(value.Y), int.Log2(value.Z), int.Log2(value.W));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static int4 operator &(int4 a, int4 b)
|
||||
{
|
||||
return new(a.X & b.X, a.Y & b.Y, a.Z & b.Z, a.W & b.W);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static int4 operator |(int4 a, int4 b)
|
||||
{
|
||||
return new(a.X | b.X, a.Y | b.Y, a.Z | b.Z, a.W | b.W);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static int4 operator ^(int4 a, int4 b)
|
||||
{
|
||||
return new(a.X ^ b.X, a.Y ^ b.Y, a.Z ^ b.Z, a.W ^ b.W);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static int4 operator ~(int4 value)
|
||||
{
|
||||
return new(~value.X, ~value.Y, ~value.Z, ~value.W);
|
||||
}
|
||||
}
|
||||
|
||||
// the componentwise predicate mask (no interface to mirror) - the per-lane truth IsPow2 collapses
|
||||
public partial struct int4
|
||||
{
|
||||
/// <summary>Determines which components of a value are powers of two.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool4 IsPow2(int4 value)
|
||||
{
|
||||
return new bool4(int.IsPow2(value.X), int.IsPow2(value.Y), int.IsPow2(value.Z), int.IsPow2(value.W));
|
||||
}
|
||||
}
|
||||
|
||||
// the good bits from IBinaryInteger - declared on IIntegerVector
|
||||
public partial struct int4
|
||||
{
|
||||
/// <inheritdoc cref="IBinaryInteger{TSelf}.PopCount" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static int4 PopCount(int4 value)
|
||||
{
|
||||
return new int4(int.PopCount(value.X), int.PopCount(value.Y), int.PopCount(value.Z), int.PopCount(value.W));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IBinaryInteger{TSelf}.LeadingZeroCount" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static int4 LeadingZeroCount(int4 value)
|
||||
{
|
||||
return new int4(int.LeadingZeroCount(value.X), int.LeadingZeroCount(value.Y), int.LeadingZeroCount(value.Z), int.LeadingZeroCount(value.W));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IBinaryInteger{TSelf}.TrailingZeroCount" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static int4 TrailingZeroCount(int4 value)
|
||||
{
|
||||
return new int4(int.TrailingZeroCount(value.X), int.TrailingZeroCount(value.Y), int.TrailingZeroCount(value.Z), int.TrailingZeroCount(value.W));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IBinaryInteger{TSelf}.RotateLeft" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static int4 RotateLeft(int4 value, int rotateAmount)
|
||||
{
|
||||
return new int4(int.RotateLeft(value.X, rotateAmount), int.RotateLeft(value.Y, rotateAmount), int.RotateLeft(value.Z, rotateAmount), int.RotateLeft(value.W, rotateAmount));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IBinaryInteger{TSelf}.RotateRight" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static int4 RotateRight(int4 value, int rotateAmount)
|
||||
{
|
||||
return new int4(int.RotateRight(value.X, rotateAmount), int.RotateRight(value.Y, rotateAmount), int.RotateRight(value.Z, rotateAmount), int.RotateRight(value.W, rotateAmount));
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue