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
9 changed files with 784842 additions and 0 deletions
28
Brutal.Numerics/Vector/uint4/uint4.copy.gen.cs
Normal file
28
Brutal.Numerics/Vector/uint4/uint4.copy.gen.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
// <auto-generated /> - edit Vector.copy.tt to modify
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.Numerics;
|
||||
|
||||
public partial struct uint4
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly void CopyTo(Span<uint> destination)
|
||||
{
|
||||
if (destination.Length < ComponentCount)
|
||||
throw new ArgumentException("Length must be at least 4.", nameof(destination));
|
||||
|
||||
Unsafe.WriteUnaligned(ref Unsafe.As<uint, byte>(ref MemoryMarshal.GetReference(destination)), this);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly bool TryCopyTo(Span<uint> destination)
|
||||
{
|
||||
if (destination.Length < ComponentCount)
|
||||
return false;
|
||||
|
||||
Unsafe.WriteUnaligned(ref Unsafe.As<uint, byte>(ref MemoryMarshal.GetReference(destination)), this);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
41
Brutal.Numerics/Vector/uint4/uint4.equality.gen.cs
Normal file
41
Brutal.Numerics/Vector/uint4/uint4.equality.gen.cs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
// <auto-generated /> - edit Vector.equality.tt to modify
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.Numerics;
|
||||
|
||||
public partial struct uint4
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public readonly override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(X, Y, Z, W);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly bool Equals(uint4 other)
|
||||
{
|
||||
return X.Equals(other.X) && Y.Equals(other.Y) && Z.Equals(other.Z) && W.Equals(other.W);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly override bool Equals([NotNullWhen(true)] object? obj)
|
||||
{
|
||||
return obj is uint4 other && Equals(other);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool operator ==(uint4 a, uint4 b)
|
||||
{
|
||||
return a.X == b.X && a.Y == b.Y && a.Z == b.Z && a.W == b.W;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool operator !=(uint4 a, uint4 b)
|
||||
{
|
||||
return !(a == b);
|
||||
}
|
||||
}
|
||||
92
Brutal.Numerics/Vector/uint4/uint4.format.gen.cs
Normal file
92
Brutal.Numerics/Vector/uint4/uint4.format.gen.cs
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
// <auto-generated /> - edit Vector.format.tt to modify
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.Numerics;
|
||||
|
||||
public partial struct uint4 : ISpanFormattable, IUtf8SpanFormattable, ISpanParsable<uint4>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public readonly override string ToString()
|
||||
{
|
||||
return ToString("G", CultureInfo.CurrentCulture);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector4.ToString(string?)" />
|
||||
public readonly string ToString(string? format)
|
||||
{
|
||||
return ToString(format, CultureInfo.CurrentCulture);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public readonly string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
var separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator;
|
||||
return $"<{X.ToString(format, formatProvider)}{separator} {Y.ToString(format, formatProvider)}{separator} {Z.ToString(format, formatProvider)}{separator} {W.ToString(format, formatProvider)}>";
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public readonly bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider)
|
||||
{
|
||||
return StringHelpers.TryFormat<uint4, uint>(this, destination, out charsWritten, format, provider);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public readonly bool TryFormat(Span<byte> destination, out int bytesWritten, ReadOnlySpan<char> format, IFormatProvider? provider)
|
||||
{
|
||||
return StringHelpers.TryFormat<uint4, uint>(this, destination, out bytesWritten, format, provider);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Parse(ReadOnlySpan{char}, NumberStyles, IFormatProvider?)" />
|
||||
public static uint4 Parse(string s, IFormatProvider? provider)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(s);
|
||||
return Parse(s.AsSpan(), NumberStyles.Integer, provider);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Parse(ReadOnlySpan{char}, NumberStyles, IFormatProvider?)" />
|
||||
public static uint4 Parse(ReadOnlySpan<char> s, IFormatProvider? provider = null)
|
||||
{
|
||||
return Parse(s, NumberStyles.Integer, provider);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Parse(ReadOnlySpan{char}, NumberStyles, IFormatProvider?)" />
|
||||
public static uint4 Parse(string s, NumberStyles style, IFormatProvider? provider)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(s);
|
||||
return Parse(s.AsSpan(), style, provider);
|
||||
}
|
||||
|
||||
/// <summary>Parses from the <see cref="ToString()" /> format, <c><1, 2, 3></c>.</summary>
|
||||
/// <exception cref="FormatException">The input is not in a valid format, or a component fails to parse.</exception>
|
||||
public static uint4 Parse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider)
|
||||
{
|
||||
if (!TryParse(s, style, provider, out var result))
|
||||
throw new FormatException($"'{s}' is not in a valid uint4 format.");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="TryParse(ReadOnlySpan{char}, NumberStyles, IFormatProvider?, out uint4)" />
|
||||
public static bool TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out uint4 result)
|
||||
{
|
||||
return TryParse(s.AsSpan(), NumberStyles.Integer, provider, out result);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="TryParse(ReadOnlySpan{char}, NumberStyles, IFormatProvider?, out uint4)" />
|
||||
public static bool TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, out uint4 result)
|
||||
{
|
||||
return TryParse(s, NumberStyles.Integer, provider, out result);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="TryParse(ReadOnlySpan{char}, NumberStyles, IFormatProvider?, out uint4)" />
|
||||
public static bool TryParse([NotNullWhen(true)] string? s, NumberStyles style, IFormatProvider? provider, out uint4 result)
|
||||
{
|
||||
return TryParse(s.AsSpan(), style, provider, out result);
|
||||
}
|
||||
|
||||
/// <summary>Parses from the <see cref="ToString()" /> format, <c><1, 2, 3></c>.</summary>
|
||||
/// <returns>true if the input parsed as a uint4.</returns>
|
||||
public static bool TryParse(ReadOnlySpan<char> s, NumberStyles style, IFormatProvider? provider, out uint4 result)
|
||||
{
|
||||
return StringHelpers.TryParse<uint4, uint>(s, style, provider, out result);
|
||||
}
|
||||
}
|
||||
147
Brutal.Numerics/Vector/uint4/uint4.gen.cs
Normal file
147
Brutal.Numerics/Vector/uint4/uint4.gen.cs
Normal file
|
|
@ -0,0 +1,147 @@
|
|||
// <auto-generated /> - edit Vector.tt to modify
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.Numerics;
|
||||
|
||||
/// <summary>
|
||||
/// Implements a 4D vector with uint components.
|
||||
/// </summary>
|
||||
[DebuggerTypeProxy(typeof(VectorDebugView4<uint4, uint, float>))]
|
||||
public partial struct uint4 : IVector4<uint4, uint>
|
||||
, IIntegerVector<uint4, uint, uint, float>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public static int ComponentSize => sizeof(uint);
|
||||
|
||||
/// <summary>Gets the number of components.</summary>
|
||||
public static int ComponentCount => 4;
|
||||
|
||||
/// <inheritdoc cref="Vector4.X" />
|
||||
[XmlAttribute]
|
||||
public uint X;
|
||||
|
||||
/// <inheritdoc cref="Vector4.Y" />
|
||||
[XmlAttribute]
|
||||
public uint Y;
|
||||
|
||||
/// <inheritdoc cref="Vector4.Z" />
|
||||
[XmlAttribute]
|
||||
public uint Z;
|
||||
|
||||
/// <inheritdoc cref="Vector4.W" />
|
||||
[XmlAttribute]
|
||||
public uint W;
|
||||
|
||||
uint IVector4<uint4, uint>.X { readonly get => X; set => X = value; }
|
||||
|
||||
uint IVector4<uint4, uint>.Y { readonly get => Y; set => Y = value; }
|
||||
|
||||
uint IVector4<uint4, uint>.Z { readonly get => Z; set => Z = value; }
|
||||
|
||||
uint IVector4<uint4, uint>.W { readonly get => W; set => W = value; }
|
||||
|
||||
/// <inheritdoc cref="Vector4(float, float, float, float)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public uint4(uint x, uint y, uint z, uint w)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
W = w;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector4(float)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public uint4(uint xyzw)
|
||||
: this(xyzw, xyzw, xyzw, xyzw) { }
|
||||
|
||||
/// <inheritdoc cref="Vector4(Vector3, float)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public uint4(uint3 xyz, uint w)
|
||||
: this(xyz.X, xyz.Y, xyz.Z, w) { }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of <see cref="uint4" /> from two <see cref="uint2" /> instances.
|
||||
/// </summary>
|
||||
/// <param name="xy">The first two components.</param>
|
||||
/// <param name="zw">The last two components.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public uint4(uint2 xy, uint2 zw)
|
||||
: this(xy.X, xy.Y, zw.X, zw.Y) { }
|
||||
|
||||
/// <inheritdoc cref="Vector4(Vector2, float, float)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public uint4(uint2 xy, uint z, uint w)
|
||||
: this(xy.X, xy.Y, z, w) { }
|
||||
|
||||
/// <summary>Creates a vector from the leading 4 elements of a span.</summary>
|
||||
/// <param name="span">The elements to read; must contain at least 4, and any beyond that are ignored.</param>
|
||||
/// <exception cref="ArgumentOutOfRangeException"><paramref name="span" /> holds fewer than 4 elements.</exception>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public uint4(ReadOnlySpan<uint> span)
|
||||
{
|
||||
if (span.Length < 4)
|
||||
throw new ArgumentOutOfRangeException(nameof(span), "Length must be at least 4.");
|
||||
|
||||
this = Unsafe.ReadUnaligned<uint4>(ref Unsafe.As<uint, byte>(ref MemoryMarshal.GetReference(span)));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="uint4(ReadOnlySpan{uint})" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
static uint4 IComponentTuple<uint4, uint>.Create(ReadOnlySpan<uint> span) => new(span);
|
||||
|
||||
/// <inheritdoc />
|
||||
public static uint4 UnitX => new(1, 0, 0, 0);
|
||||
|
||||
/// <inheritdoc />
|
||||
public static uint4 UnitY => new(0, 1, 0, 0);
|
||||
|
||||
/// <inheritdoc />
|
||||
public static uint4 UnitZ => new(0, 0, 1, 0);
|
||||
|
||||
/// <inheritdoc />
|
||||
public static uint4 UnitW => new(0, 0, 0, 1);
|
||||
|
||||
/// <inheritdoc />
|
||||
public uint this[int index]
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get
|
||||
{
|
||||
if ((uint)index >= ComponentCount)
|
||||
throw new ArgumentOutOfRangeException(nameof(index));
|
||||
|
||||
return Unsafe.Add(ref Unsafe.AsRef(in X), index);
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
set
|
||||
{
|
||||
if ((uint)index >= ComponentCount)
|
||||
throw new ArgumentOutOfRangeException(nameof(index));
|
||||
|
||||
Unsafe.Add(ref X, index) = value;
|
||||
}
|
||||
}
|
||||
|
||||
public readonly void Deconstruct(out uint x, out uint y, out uint z, out uint w)
|
||||
{
|
||||
x = X;
|
||||
y = Y;
|
||||
z = Z;
|
||||
w = W;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public Span<uint> AsSpan()
|
||||
{
|
||||
return MemoryMarshal.CreateSpan(ref Unsafe.As<uint4, uint>(ref this), 4);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly ReadOnlySpan<uint> AsReadOnlySpan()
|
||||
{
|
||||
return MemoryMarshal.CreateReadOnlySpan(in Unsafe.As<uint4, uint>(ref Unsafe.AsRef(in this)), 4);
|
||||
}
|
||||
}
|
||||
43
Brutal.Numerics/Vector/uint4/uint4.math-metric.gen.cs
Normal file
43
Brutal.Numerics/Vector/uint4/uint4.math-metric.gen.cs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
// <auto-generated /> - edit Vector.math-metric.tt to modify
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.Numerics;
|
||||
|
||||
public partial struct uint4
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly float Length()
|
||||
{
|
||||
return (float)double.Sqrt((double)X * X + (double)Y * Y + (double)Z * Z + (double)W * W);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly uint LengthSquared()
|
||||
{
|
||||
return Dot(this, this);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector4.Distance" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float Distance(uint4 a, uint4 b)
|
||||
{
|
||||
return (float)double.Sqrt(((double)a.X - b.X) * ((double)a.X - b.X) + ((double)a.Y - b.Y) * ((double)a.Y - b.Y) + ((double)a.Z - b.Z) * ((double)a.Z - b.Z) + ((double)a.W - b.W) * ((double)a.W - b.W));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector4.DistanceSquared" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint DistanceSquared(uint4 a, uint4 b)
|
||||
{
|
||||
var difference = a - b;
|
||||
return Dot(difference, difference);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector4.Dot" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint Dot(uint4 a, uint4 b)
|
||||
{
|
||||
return a.X * b.X + a.Y * b.Y + a.Z * b.Z + a.W * b.W;
|
||||
}
|
||||
}
|
||||
100
Brutal.Numerics/Vector/uint4/uint4.numerics-binary.gen.cs
Normal file
100
Brutal.Numerics/Vector/uint4/uint4.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 uint4 : IBinaryNumber<uint4>
|
||||
{
|
||||
/// <summary>Determines if every component of a value is a power of two.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
static bool IBinaryNumber<uint4>.IsPow2(uint4 value)
|
||||
{
|
||||
return uint.IsPow2(value.X) && uint.IsPow2(value.Y) && uint.IsPow2(value.Z) && uint.IsPow2(value.W);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IBinaryNumber{TSelf}.Log2" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint4 Log2(uint4 value)
|
||||
{
|
||||
return new uint4(uint.Log2(value.X), uint.Log2(value.Y), uint.Log2(value.Z), uint.Log2(value.W));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint4 operator &(uint4 a, uint4 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 uint4 operator |(uint4 a, uint4 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 uint4 operator ^(uint4 a, uint4 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 uint4 operator ~(uint4 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 uint4
|
||||
{
|
||||
/// <summary>Determines which components of a value are powers of two.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool4 IsPow2(uint4 value)
|
||||
{
|
||||
return new bool4(uint.IsPow2(value.X), uint.IsPow2(value.Y), uint.IsPow2(value.Z), uint.IsPow2(value.W));
|
||||
}
|
||||
}
|
||||
|
||||
// the good bits from IBinaryInteger - declared on IIntegerVector
|
||||
public partial struct uint4
|
||||
{
|
||||
/// <inheritdoc cref="IBinaryInteger{TSelf}.PopCount" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint4 PopCount(uint4 value)
|
||||
{
|
||||
return new uint4(uint.PopCount(value.X), uint.PopCount(value.Y), uint.PopCount(value.Z), uint.PopCount(value.W));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IBinaryInteger{TSelf}.LeadingZeroCount" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint4 LeadingZeroCount(uint4 value)
|
||||
{
|
||||
return new uint4(uint.LeadingZeroCount(value.X), uint.LeadingZeroCount(value.Y), uint.LeadingZeroCount(value.Z), uint.LeadingZeroCount(value.W));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IBinaryInteger{TSelf}.TrailingZeroCount" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint4 TrailingZeroCount(uint4 value)
|
||||
{
|
||||
return new uint4(uint.TrailingZeroCount(value.X), uint.TrailingZeroCount(value.Y), uint.TrailingZeroCount(value.Z), uint.TrailingZeroCount(value.W));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IBinaryInteger{TSelf}.RotateLeft" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint4 RotateLeft(uint4 value, int rotateAmount)
|
||||
{
|
||||
return new uint4(uint.RotateLeft(value.X, rotateAmount), uint.RotateLeft(value.Y, rotateAmount), uint.RotateLeft(value.Z, rotateAmount), uint.RotateLeft(value.W, rotateAmount));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IBinaryInteger{TSelf}.RotateRight" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint4 RotateRight(uint4 value, int rotateAmount)
|
||||
{
|
||||
return new uint4(uint.RotateRight(value.X, rotateAmount), uint.RotateRight(value.Y, rotateAmount), uint.RotateRight(value.Z, rotateAmount), uint.RotateRight(value.W, rotateAmount));
|
||||
}
|
||||
}
|
||||
389
Brutal.Numerics/Vector/uint4/uint4.numerics.gen.cs
Normal file
389
Brutal.Numerics/Vector/uint4/uint4.numerics.gen.cs
Normal file
|
|
@ -0,0 +1,389 @@
|
|||
// <auto-generated /> - edit Vector.numerics.tt to modify
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.Numerics;
|
||||
|
||||
// INumberBase
|
||||
public partial struct uint4 : INumberBase<uint4>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public static uint4 Zero => new(0);
|
||||
|
||||
/// <inheritdoc />
|
||||
public static uint4 One => new(1);
|
||||
|
||||
static uint4 IAdditiveIdentity<uint4, uint4>.AdditiveIdentity => Zero;
|
||||
|
||||
static uint4 IMultiplicativeIdentity<uint4, uint4>.MultiplicativeIdentity => One;
|
||||
|
||||
static int INumberBase<uint4>.Radix => 2; // every component type is binary
|
||||
|
||||
static uint4 INumberBase<uint4>.Abs(uint4 value) => value;
|
||||
|
||||
static bool INumberBase<uint4>.IsCanonical(uint4 value) => true;
|
||||
|
||||
static bool INumberBase<uint4>.IsComplexNumber(uint4 value) => false;
|
||||
|
||||
static bool INumberBase<uint4>.IsImaginaryNumber(uint4 value) => false;
|
||||
|
||||
/// <summary>Determines if every component of a value is zero.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
static bool INumberBase<uint4>.IsZero(uint4 value)
|
||||
{
|
||||
return value == Zero;
|
||||
}
|
||||
|
||||
/// <summary>Determines if every component of a value is an even integral value.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
static bool INumberBase<uint4>.IsEvenInteger(uint4 value)
|
||||
{
|
||||
return (value.X & 1) == 0 && (value.Y & 1) == 0 && (value.Z & 1) == 0 && (value.W & 1) == 0;
|
||||
}
|
||||
|
||||
/// <summary>Determines if every component of a value is an odd integral value.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
static bool INumberBase<uint4>.IsOddInteger(uint4 value)
|
||||
{
|
||||
return (value.X & 1) == 1 && (value.Y & 1) == 1 && (value.Z & 1) == 1 && (value.W & 1) == 1;
|
||||
}
|
||||
|
||||
static bool INumberBase<uint4>.IsNegative(uint4 value) => false;
|
||||
|
||||
static bool INumberBase<uint4>.IsPositive(uint4 value) => true;
|
||||
|
||||
static bool INumberBase<uint4>.IsFinite(uint4 value) => true;
|
||||
|
||||
static bool INumberBase<uint4>.IsInfinity(uint4 value) => false;
|
||||
|
||||
static bool INumberBase<uint4>.IsNegativeInfinity(uint4 value) => false;
|
||||
|
||||
static bool INumberBase<uint4>.IsPositiveInfinity(uint4 value) => false;
|
||||
|
||||
static bool INumberBase<uint4>.IsInteger(uint4 value) => true;
|
||||
|
||||
static bool INumberBase<uint4>.IsRealNumber(uint4 value) => true;
|
||||
|
||||
static bool INumberBase<uint4>.IsNaN(uint4 value) => false;
|
||||
|
||||
static bool INumberBase<uint4>.IsNormal(uint4 value) => value.X != 0 && value.Y != 0 && value.Z != 0 && value.W != 0;
|
||||
|
||||
static bool INumberBase<uint4>.IsSubnormal(uint4 value) => false;
|
||||
|
||||
/// <summary>Computes, componentwise, the value whose magnitude is greater.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint4 MaxMagnitude(uint4 a, uint4 b)
|
||||
{
|
||||
return Max(a, b);
|
||||
}
|
||||
|
||||
/// <summary>Computes, componentwise, the value whose magnitude is greater.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint4 MaxMagnitudeNumber(uint4 a, uint4 b)
|
||||
{
|
||||
return Max(a, b);
|
||||
}
|
||||
|
||||
/// <summary>Computes, componentwise, the value whose magnitude is smaller.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint4 MinMagnitude(uint4 a, uint4 b)
|
||||
{
|
||||
return Min(a, b);
|
||||
}
|
||||
|
||||
/// <summary>Computes, componentwise, the value whose magnitude is smaller.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint4 MinMagnitudeNumber(uint4 a, uint4 b)
|
||||
{
|
||||
return Min(a, b);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector4.Add" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint4 Add(uint4 a, uint4 b)
|
||||
{
|
||||
return a + b;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector4.Divide(Vector4, Vector4)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint4 Divide(uint4 a, uint4 b)
|
||||
{
|
||||
return a / b;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector4.Multiply(Vector4, Vector4)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint4 Multiply(uint4 a, uint4 b)
|
||||
{
|
||||
return a * b;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector4.Negate" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint4 Negate(uint4 value)
|
||||
{
|
||||
return -value;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector4.Subtract" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint4 Subtract(uint4 a, uint4 b)
|
||||
{
|
||||
return a - b;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint4 operator +(uint4 a, uint4 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 uint4 operator -(uint4 a, uint4 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 uint4 operator *(uint4 a, uint4 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 uint4 operator /(uint4 a, uint4 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 uint4 operator -(uint4 a)
|
||||
{
|
||||
return new(0 - a.X, 0 - a.Y, 0 - a.Z, 0 - a.W);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint4 operator +(uint4 a)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
|
||||
// ++/-- are well-defined (+/- One) but a footgun on a concrete vector: generic-plane only.
|
||||
|
||||
static uint4 IIncrementOperators<uint4>.operator ++(uint4 value) => value + One;
|
||||
|
||||
static uint4 IDecrementOperators<uint4>.operator --(uint4 value) => value - One;
|
||||
|
||||
|
||||
static bool INumberBase<uint4>.TryConvertFromChecked<TOther>(TOther value, out uint4 result)
|
||||
{
|
||||
return NumberConversion.TryConvertFrom<uint4, uint, TOther, NumberConversion.Checked>(value, out result);
|
||||
}
|
||||
|
||||
static bool INumberBase<uint4>.TryConvertToChecked<TOther>(uint4 value, [MaybeNullWhen(false)] out TOther result)
|
||||
{
|
||||
result = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool INumberBase<uint4>.TryConvertFromSaturating<TOther>(TOther value, out uint4 result)
|
||||
{
|
||||
return NumberConversion.TryConvertFrom<uint4, uint, TOther, NumberConversion.Saturating>(value, out result);
|
||||
}
|
||||
|
||||
static bool INumberBase<uint4>.TryConvertToSaturating<TOther>(uint4 value, [MaybeNullWhen(false)] out TOther result)
|
||||
{
|
||||
result = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool INumberBase<uint4>.TryConvertFromTruncating<TOther>(TOther value, out uint4 result)
|
||||
{
|
||||
return NumberConversion.TryConvertFrom<uint4, uint, TOther, NumberConversion.Truncating>(value, out result);
|
||||
}
|
||||
|
||||
static bool INumberBase<uint4>.TryConvertToTruncating<TOther>(uint4 value, [MaybeNullWhen(false)] out TOther result)
|
||||
{
|
||||
result = default;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// IMultiplyOperators<TSelf, TComponent, TSelf>, IDivisionOperators<TSelf, TComponent, TSelf>
|
||||
public partial struct uint4
|
||||
: IMultiplyOperators<uint4, uint, uint4>
|
||||
, IDivisionOperators<uint4, uint, uint4>
|
||||
{
|
||||
/// <inheritdoc cref="Vector4.Divide(Vector4, float)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint4 Divide(uint4 a, uint b)
|
||||
{
|
||||
return a / b;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector4.Multiply(Vector4, float)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint4 Multiply(uint4 a, uint b)
|
||||
{
|
||||
return a * b;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector4.Multiply(float, Vector4)" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint4 Multiply(uint a, uint4 b)
|
||||
{
|
||||
return a * b;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint4 operator *(uint4 a, uint b)
|
||||
{
|
||||
return new(a.X * b, a.Y * b, a.Z * b, a.W * b);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint4 operator /(uint4 a, uint b)
|
||||
{
|
||||
return new(a.X / b, a.Y / b, a.Z / b, a.W / b);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint4 operator *(uint a, uint4 b)
|
||||
{
|
||||
return new(a * b.X, a * b.Y, a * b.Z, a * b.W);
|
||||
}
|
||||
}
|
||||
|
||||
// INumber
|
||||
public partial struct uint4 : INumber<uint4>
|
||||
{
|
||||
/// <inheritdoc cref="Vector4.Clamp" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint4 Clamp(uint4 value, uint4 min, uint4 max)
|
||||
{
|
||||
// HLSL contract when min > max: max wins (clamp is Max-then-Min); pinned in
|
||||
// Clamp_InvertedBounds_MatchesBcl. NOT scalar T.Clamp, which throws on inversion.
|
||||
return Min(Max(value, min), max);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector4.Max" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint4 Max(uint4 a, uint4 b)
|
||||
{
|
||||
return new(uint.Max(a.X, b.X), uint.Max(a.Y, b.Y), uint.Max(a.Z, b.Z), uint.Max(a.W, b.W));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Vector4.Min" />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint4 Min(uint4 a, uint4 b)
|
||||
{
|
||||
return new(uint.Min(a.X, b.X), uint.Min(a.Y, b.Y), uint.Min(a.Z, b.Z), uint.Min(a.W, b.W));
|
||||
}
|
||||
|
||||
static uint4 INumber<uint4>.MaxNumber(uint4 a, uint4 b) => Max(a, b);
|
||||
|
||||
static uint4 INumber<uint4>.MinNumber(uint4 a, uint4 b) => Min(a, b);
|
||||
|
||||
static uint4 INumber<uint4>.CopySign(uint4 value, uint4 sign) => value;
|
||||
|
||||
// the Native variants permit either NaN/signed-zero behavior - forwarding is always legal
|
||||
static uint4 INumber<uint4>.ClampNative(uint4 value, uint4 min, uint4 max) => Clamp(value, min, max);
|
||||
|
||||
static uint4 INumber<uint4>.MaxNative(uint4 a, uint4 b) => Max(a, b);
|
||||
|
||||
static uint4 INumber<uint4>.MinNative(uint4 a, uint4 b) => Min(a, b);
|
||||
|
||||
// Sign's int return cannot hold a per-lane answer, and a collapsed one would lie for mixed signs
|
||||
static int INumber<uint4>.Sign(uint4 value) =>
|
||||
throw new NotSupportedException($"{nameof(uint4)} has no scalar sign.");
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static uint4 operator %(uint4 a, uint4 b)
|
||||
{
|
||||
return new uint4(a.X % b.X, a.Y % b.Y, a.Z % b.Z, a.W % b.W);
|
||||
}
|
||||
|
||||
int IComparable.CompareTo(object? obj) =>
|
||||
throw new NotSupportedException($"{nameof(uint4)} has no total order.");
|
||||
|
||||
int IComparable<uint4>.CompareTo(uint4 other) =>
|
||||
throw new NotSupportedException($"{nameof(uint4)} has no total order.");
|
||||
|
||||
static bool IComparisonOperators<uint4, uint4, bool>.operator <(uint4 a, uint4 b) =>
|
||||
throw new NotSupportedException($"{nameof(uint4)} has no total order.");
|
||||
|
||||
static bool IComparisonOperators<uint4, uint4, bool>.operator <=(uint4 a, uint4 b) =>
|
||||
throw new NotSupportedException($"{nameof(uint4)} has no total order.");
|
||||
|
||||
static bool IComparisonOperators<uint4, uint4, bool>.operator >(uint4 a, uint4 b) =>
|
||||
throw new NotSupportedException($"{nameof(uint4)} has no total order.");
|
||||
|
||||
static bool IComparisonOperators<uint4, uint4, bool>.operator >=(uint4 a, uint4 b) =>
|
||||
throw new NotSupportedException($"{nameof(uint4)} has no total order.");
|
||||
}
|
||||
|
||||
// IComponentwiseComparison + the componentwise predicate masks (no interface to mirror)
|
||||
public partial struct uint4 : IComponentwiseComparison<uint4, bool4>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool4 operator <(uint4 a, uint4 b)
|
||||
{
|
||||
return new bool4(a.X < b.X, a.Y < b.Y, a.Z < b.Z, a.W < b.W);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool4 operator <=(uint4 a, uint4 b)
|
||||
{
|
||||
return new bool4(a.X <= b.X, a.Y <= b.Y, a.Z <= b.Z, a.W <= b.W);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool4 operator >(uint4 a, uint4 b)
|
||||
{
|
||||
return new bool4(a.X > b.X, a.Y > b.Y, a.Z > b.Z, a.W > b.W);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool4 operator >=(uint4 a, uint4 b)
|
||||
{
|
||||
return new bool4(a.X >= b.X, a.Y >= b.Y, a.Z >= b.Z, a.W >= b.W);
|
||||
}
|
||||
|
||||
/// <summary>Determines which components of a value are zero.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool4 IsZero(uint4 value)
|
||||
{
|
||||
return new bool4(value.X == 0, value.Y == 0, value.Z == 0, value.W == 0);
|
||||
}
|
||||
|
||||
/// <summary>Determines which components of a value are an even integral value.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool4 IsEvenInteger(uint4 value)
|
||||
{
|
||||
return new bool4(uint.IsEvenInteger(value.X), uint.IsEvenInteger(value.Y), uint.IsEvenInteger(value.Z), uint.IsEvenInteger(value.W));
|
||||
}
|
||||
|
||||
/// <summary>Determines which components of a value are an odd integral value.</summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool4 IsOddInteger(uint4 value)
|
||||
{
|
||||
return new bool4(uint.IsOddInteger(value.X), uint.IsOddInteger(value.Y), uint.IsOddInteger(value.Z), uint.IsOddInteger(value.W));
|
||||
}
|
||||
}
|
||||
|
||||
// IUnsignedNumber - a marker, so there is nothing to implement
|
||||
public partial struct uint4 : IUnsignedNumber<uint4>;
|
||||
210
Brutal.Numerics/Vector/uint4/uint4.pack.gen.cs
Normal file
210
Brutal.Numerics/Vector/uint4/uint4.pack.gen.cs
Normal file
|
|
@ -0,0 +1,210 @@
|
|||
// <auto-generated /> - edit Vector.pack.tt to modify
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.Numerics;
|
||||
|
||||
public partial struct uint4
|
||||
{
|
||||
public static uint4 Unpack(in sbyte4 vector, Func<sbyte, uint> elementConverter)
|
||||
{
|
||||
VectorPack.Pack(vector, out uint4 result, elementConverter);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static uint4 Unpack(in byte4 vector, Func<byte, uint> elementConverter)
|
||||
{
|
||||
VectorPack.Pack(vector, out uint4 result, elementConverter);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static uint4 Unpack(in short4 vector, Func<short, uint> elementConverter)
|
||||
{
|
||||
VectorPack.Pack(vector, out uint4 result, elementConverter);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static uint4 Unpack(in ushort4 vector, Func<ushort, uint> elementConverter)
|
||||
{
|
||||
VectorPack.Pack(vector, out uint4 result, elementConverter);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static uint4 Unpack(in int4 vector, Func<int, uint> elementConverter)
|
||||
{
|
||||
VectorPack.Pack(vector, out uint4 result, elementConverter);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static uint4 Pack(in float4 vector, Func<float, uint> elementConverter)
|
||||
{
|
||||
VectorPack.Pack(vector, out uint4 result, elementConverter);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static uint4 Pack(in double4 vector, Func<double, uint> elementConverter)
|
||||
{
|
||||
VectorPack.Pack(vector, out uint4 result, elementConverter);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static uint4 Unpack(in sbyte4 vector, Unpack.IntegerMixed mode = Numerics.Unpack.IntegerMixed.Cast)
|
||||
{
|
||||
return Unpack(vector, PackUtils.SByte.ToUInt(mode));
|
||||
}
|
||||
|
||||
public static uint4 Unpack(in byte4 vector, Unpack.Integer mode = Numerics.Unpack.Integer.Cast)
|
||||
{
|
||||
return Unpack(vector, PackUtils.Byte.ToUInt(mode));
|
||||
}
|
||||
|
||||
public static uint4 Unpack(in short4 vector, Unpack.IntegerMixed mode = Numerics.Unpack.IntegerMixed.Cast)
|
||||
{
|
||||
return Unpack(vector, PackUtils.Short.ToUInt(mode));
|
||||
}
|
||||
|
||||
public static uint4 Unpack(in ushort4 vector, Unpack.Integer mode = Numerics.Unpack.Integer.Cast)
|
||||
{
|
||||
return Unpack(vector, PackUtils.UShort.ToUInt(mode));
|
||||
}
|
||||
|
||||
public static uint4 Unpack(in int4 vector, Unpack.IntegerMixed mode = Numerics.Unpack.IntegerMixed.Cast)
|
||||
{
|
||||
return Unpack(vector, PackUtils.Int.ToUInt(mode));
|
||||
}
|
||||
|
||||
public static uint4 Pack(in float4 vector, Pack.Float mode = Numerics.Pack.Float.Truncate)
|
||||
{
|
||||
return Pack(vector, PackUtils.Float.ToUInt(mode));
|
||||
}
|
||||
|
||||
public static uint4 Pack(in double4 vector, Pack.Float mode = Numerics.Pack.Float.Truncate)
|
||||
{
|
||||
return Pack(vector, PackUtils.Double.ToUInt(mode));
|
||||
}
|
||||
|
||||
public static void UnpackSpan(
|
||||
in ReadOnlySpan<sbyte4> source,
|
||||
Span<uint4> destination,
|
||||
Func<sbyte, uint> elementConverter
|
||||
)
|
||||
{
|
||||
VectorPack.Pack(source, destination, elementConverter);
|
||||
}
|
||||
|
||||
public static void UnpackSpan(
|
||||
in ReadOnlySpan<byte4> source,
|
||||
Span<uint4> destination,
|
||||
Func<byte, uint> elementConverter
|
||||
)
|
||||
{
|
||||
VectorPack.Pack(source, destination, elementConverter);
|
||||
}
|
||||
|
||||
public static void UnpackSpan(
|
||||
in ReadOnlySpan<short4> source,
|
||||
Span<uint4> destination,
|
||||
Func<short, uint> elementConverter
|
||||
)
|
||||
{
|
||||
VectorPack.Pack(source, destination, elementConverter);
|
||||
}
|
||||
|
||||
public static void UnpackSpan(
|
||||
in ReadOnlySpan<ushort4> source,
|
||||
Span<uint4> destination,
|
||||
Func<ushort, uint> elementConverter
|
||||
)
|
||||
{
|
||||
VectorPack.Pack(source, destination, elementConverter);
|
||||
}
|
||||
|
||||
public static void UnpackSpan(
|
||||
in ReadOnlySpan<int4> source,
|
||||
Span<uint4> destination,
|
||||
Func<int, uint> elementConverter
|
||||
)
|
||||
{
|
||||
VectorPack.Pack(source, destination, elementConverter);
|
||||
}
|
||||
|
||||
public static void PackSpan(
|
||||
in ReadOnlySpan<float4> source,
|
||||
Span<uint4> destination,
|
||||
Func<float, uint> elementConverter
|
||||
)
|
||||
{
|
||||
VectorPack.Pack(source, destination, elementConverter);
|
||||
}
|
||||
|
||||
public static void PackSpan(
|
||||
in ReadOnlySpan<double4> source,
|
||||
Span<uint4> destination,
|
||||
Func<double, uint> elementConverter
|
||||
)
|
||||
{
|
||||
VectorPack.Pack(source, destination, elementConverter);
|
||||
}
|
||||
|
||||
public static void UnpackSpan(
|
||||
in ReadOnlySpan<sbyte4> source,
|
||||
Span<uint4> destination,
|
||||
Unpack.IntegerMixed mode = Numerics.Unpack.IntegerMixed.Cast
|
||||
)
|
||||
{
|
||||
UnpackSpan(source, destination, PackUtils.SByte.ToUInt(mode));
|
||||
}
|
||||
|
||||
public static void UnpackSpan(
|
||||
in ReadOnlySpan<byte4> source,
|
||||
Span<uint4> destination,
|
||||
Unpack.Integer mode = Numerics.Unpack.Integer.Cast
|
||||
)
|
||||
{
|
||||
UnpackSpan(source, destination, PackUtils.Byte.ToUInt(mode));
|
||||
}
|
||||
|
||||
public static void UnpackSpan(
|
||||
in ReadOnlySpan<short4> source,
|
||||
Span<uint4> destination,
|
||||
Unpack.IntegerMixed mode = Numerics.Unpack.IntegerMixed.Cast
|
||||
)
|
||||
{
|
||||
UnpackSpan(source, destination, PackUtils.Short.ToUInt(mode));
|
||||
}
|
||||
|
||||
public static void UnpackSpan(
|
||||
in ReadOnlySpan<ushort4> source,
|
||||
Span<uint4> destination,
|
||||
Unpack.Integer mode = Numerics.Unpack.Integer.Cast
|
||||
)
|
||||
{
|
||||
UnpackSpan(source, destination, PackUtils.UShort.ToUInt(mode));
|
||||
}
|
||||
|
||||
public static void UnpackSpan(
|
||||
in ReadOnlySpan<int4> source,
|
||||
Span<uint4> destination,
|
||||
Unpack.IntegerMixed mode = Numerics.Unpack.IntegerMixed.Cast
|
||||
)
|
||||
{
|
||||
UnpackSpan(source, destination, PackUtils.Int.ToUInt(mode));
|
||||
}
|
||||
|
||||
public static void PackSpan(
|
||||
in ReadOnlySpan<float4> source,
|
||||
Span<uint4> destination,
|
||||
Pack.Float mode = Numerics.Pack.Float.Truncate
|
||||
)
|
||||
{
|
||||
PackSpan(source, destination, PackUtils.Float.ToUInt(mode));
|
||||
}
|
||||
|
||||
public static void PackSpan(
|
||||
in ReadOnlySpan<double4> source,
|
||||
Span<uint4> destination,
|
||||
Pack.Float mode = Numerics.Pack.Float.Truncate
|
||||
)
|
||||
{
|
||||
PackSpan(source, destination, PackUtils.Double.ToUInt(mode));
|
||||
}
|
||||
}
|
||||
1963
Brutal.Numerics/Vector/uint4/uint4.swizzle.gen.cs
Normal file
1963
Brutal.Numerics/Vector/uint4/uint4.swizzle.gen.cs
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue