mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-26 04:58:24 +01:00
first
This commit is contained in:
parent
bd62d51ec9
commit
b578433e37
1 changed files with 784842 additions and 0 deletions
217
Brutal.Numerics/Vector/byte4/byte4.pack.gen.cs
Normal file
217
Brutal.Numerics/Vector/byte4/byte4.pack.gen.cs
Normal file
|
|
@ -0,0 +1,217 @@
|
|||
// <auto-generated /> - edit Vector.pack.tt to modify
|
||||
#nullable enable
|
||||
|
||||
namespace Brutal.Numerics;
|
||||
|
||||
public partial struct byte4
|
||||
{
|
||||
public static byte4 Unpack(in sbyte4 vector, Func<sbyte, byte> elementConverter)
|
||||
{
|
||||
VectorPack.Pack(vector, out byte4 result, elementConverter);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static byte4 Pack(in short4 vector, Func<short, byte> elementConverter)
|
||||
{
|
||||
VectorPack.Pack(vector, out byte4 result, elementConverter);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static byte4 Pack(in ushort4 vector, Func<ushort, byte> elementConverter)
|
||||
{
|
||||
VectorPack.Pack(vector, out byte4 result, elementConverter);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static byte4 Pack(in int4 vector, Func<int, byte> elementConverter)
|
||||
{
|
||||
VectorPack.Pack(vector, out byte4 result, elementConverter);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static byte4 Pack(in uint4 vector, Func<uint, byte> elementConverter)
|
||||
{
|
||||
VectorPack.Pack(vector, out byte4 result, elementConverter);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static byte4 Pack(in float4 vector, Func<float, byte> elementConverter)
|
||||
{
|
||||
VectorPack.Pack(vector, out byte4 result, elementConverter);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static byte4 Pack(in double4 vector, Func<double, byte> elementConverter)
|
||||
{
|
||||
VectorPack.Pack(vector, out byte4 result, elementConverter);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static byte4 Unpack(in sbyte4 vector, Unpack.IntegerMixed mode = Numerics.Unpack.IntegerMixed.Cast)
|
||||
{
|
||||
return Unpack(vector, PackUtils.SByte.ToByte(mode));
|
||||
}
|
||||
|
||||
public static byte4 Pack(in short4 vector, Pack.IntegerMixed mode = Numerics.Pack.IntegerMixed.Cast)
|
||||
{
|
||||
return Pack(vector, PackUtils.Short.ToByte(mode));
|
||||
}
|
||||
|
||||
public static byte4 Pack(in ushort4 vector, Pack.Integer mode = Numerics.Pack.Integer.Cast)
|
||||
{
|
||||
return Pack(vector, PackUtils.UShort.ToByte(mode));
|
||||
}
|
||||
|
||||
public static byte4 Pack(in int4 vector, Pack.IntegerMixed mode = Numerics.Pack.IntegerMixed.Cast)
|
||||
{
|
||||
return Pack(vector, PackUtils.Int.ToByte(mode));
|
||||
}
|
||||
|
||||
public static byte4 Pack(in uint4 vector, Pack.Integer mode = Numerics.Pack.Integer.Cast)
|
||||
{
|
||||
return Pack(vector, PackUtils.UInt.ToByte(mode));
|
||||
}
|
||||
|
||||
public static byte4 Pack(in float4 vector, Pack.Float mode = Numerics.Pack.Float.Truncate)
|
||||
{
|
||||
return Pack(vector, PackUtils.Float.ToByte(mode));
|
||||
}
|
||||
|
||||
public static byte4 Pack(in double4 vector, Pack.Float mode = Numerics.Pack.Float.Truncate)
|
||||
{
|
||||
return Pack(vector, PackUtils.Double.ToByte(mode));
|
||||
}
|
||||
|
||||
public static void UnpackSpan(
|
||||
in ReadOnlySpan<sbyte4> source,
|
||||
Span<byte4> destination,
|
||||
Func<sbyte, byte> elementConverter
|
||||
)
|
||||
{
|
||||
VectorPack.Pack(source, destination, elementConverter);
|
||||
}
|
||||
|
||||
public static void PackSpan(
|
||||
in ReadOnlySpan<short4> source,
|
||||
Span<byte4> destination,
|
||||
Func<short, byte> elementConverter
|
||||
)
|
||||
{
|
||||
VectorPack.Pack(source, destination, elementConverter);
|
||||
}
|
||||
|
||||
public static void PackSpan(
|
||||
in ReadOnlySpan<ushort4> source,
|
||||
Span<byte4> destination,
|
||||
Func<ushort, byte> elementConverter
|
||||
)
|
||||
{
|
||||
VectorPack.Pack(source, destination, elementConverter);
|
||||
}
|
||||
|
||||
public static void PackSpan(
|
||||
in ReadOnlySpan<int4> source,
|
||||
Span<byte4> destination,
|
||||
Func<int, byte> elementConverter
|
||||
)
|
||||
{
|
||||
VectorPack.Pack(source, destination, elementConverter);
|
||||
}
|
||||
|
||||
public static void PackSpan(
|
||||
in ReadOnlySpan<uint4> source,
|
||||
Span<byte4> destination,
|
||||
Func<uint, byte> elementConverter
|
||||
)
|
||||
{
|
||||
VectorPack.Pack(source, destination, elementConverter);
|
||||
}
|
||||
|
||||
public static void PackSpan(
|
||||
in ReadOnlySpan<float4> source,
|
||||
Span<byte4> destination,
|
||||
Func<float, byte> elementConverter
|
||||
)
|
||||
{
|
||||
VectorPack.Pack(source, destination, elementConverter);
|
||||
}
|
||||
|
||||
public static void PackSpan(
|
||||
in ReadOnlySpan<double4> source,
|
||||
Span<byte4> destination,
|
||||
Func<double, byte> elementConverter
|
||||
)
|
||||
{
|
||||
VectorPack.Pack(source, destination, elementConverter);
|
||||
}
|
||||
|
||||
public static void UnpackSpan(
|
||||
in ReadOnlySpan<sbyte4> source,
|
||||
Span<byte4> destination,
|
||||
Unpack.IntegerMixed mode = Numerics.Unpack.IntegerMixed.Cast
|
||||
)
|
||||
{
|
||||
UnpackSpan(source, destination, PackUtils.SByte.ToByte(mode));
|
||||
}
|
||||
|
||||
public static void PackSpan(
|
||||
in ReadOnlySpan<short4> source,
|
||||
Span<byte4> destination,
|
||||
Pack.IntegerMixed mode = Numerics.Pack.IntegerMixed.Cast
|
||||
)
|
||||
{
|
||||
PackSpan(source, destination, PackUtils.Short.ToByte(mode));
|
||||
}
|
||||
|
||||
public static void PackSpan(
|
||||
in ReadOnlySpan<ushort4> source,
|
||||
Span<byte4> destination,
|
||||
Pack.Integer mode = Numerics.Pack.Integer.Cast
|
||||
)
|
||||
{
|
||||
PackSpan(source, destination, PackUtils.UShort.ToByte(mode));
|
||||
}
|
||||
|
||||
public static void PackSpan(
|
||||
in ReadOnlySpan<int4> source,
|
||||
Span<byte4> destination,
|
||||
Pack.IntegerMixed mode = Numerics.Pack.IntegerMixed.Cast
|
||||
)
|
||||
{
|
||||
PackSpan(source, destination, PackUtils.Int.ToByte(mode));
|
||||
}
|
||||
|
||||
public static void PackSpan(
|
||||
in ReadOnlySpan<uint4> source,
|
||||
Span<byte4> destination,
|
||||
Pack.Integer mode = Numerics.Pack.Integer.Cast
|
||||
)
|
||||
{
|
||||
PackSpan(source, destination, PackUtils.UInt.ToByte(mode));
|
||||
}
|
||||
|
||||
public static void PackSpan(
|
||||
in ReadOnlySpan<float4> source,
|
||||
Span<byte4> destination,
|
||||
Pack.Float mode = Numerics.Pack.Float.Truncate
|
||||
)
|
||||
{
|
||||
PackSpan(source, destination, PackUtils.Float.ToByte(mode));
|
||||
}
|
||||
|
||||
public static void PackSpan(
|
||||
in ReadOnlySpan<double4> source,
|
||||
Span<byte4> destination,
|
||||
Pack.Float mode = Numerics.Pack.Float.Truncate
|
||||
)
|
||||
{
|
||||
PackSpan(source, destination, PackUtils.Double.ToByte(mode));
|
||||
}
|
||||
|
||||
// the packed-RGBA8888 color affordance (byte4 is the RGBA byte color); implicitness to revisit with the Color milestone
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static implicit operator uint(byte4 v)
|
||||
{
|
||||
return Unsafe.BitCast<byte4, uint>(v);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue