mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 12:38:24 +01:00
210 lines
5.9 KiB
C#
210 lines
5.9 KiB
C#
// <auto-generated /> - edit Vector.pack.tt to modify
|
|
#nullable enable
|
|
|
|
namespace Brutal.Numerics;
|
|
|
|
public partial struct byte2
|
|
{
|
|
public static byte2 Unpack(in sbyte2 vector, Func<sbyte, byte> elementConverter)
|
|
{
|
|
VectorPack.Pack(vector, out byte2 result, elementConverter);
|
|
return result;
|
|
}
|
|
|
|
public static byte2 Pack(in short2 vector, Func<short, byte> elementConverter)
|
|
{
|
|
VectorPack.Pack(vector, out byte2 result, elementConverter);
|
|
return result;
|
|
}
|
|
|
|
public static byte2 Pack(in ushort2 vector, Func<ushort, byte> elementConverter)
|
|
{
|
|
VectorPack.Pack(vector, out byte2 result, elementConverter);
|
|
return result;
|
|
}
|
|
|
|
public static byte2 Pack(in int2 vector, Func<int, byte> elementConverter)
|
|
{
|
|
VectorPack.Pack(vector, out byte2 result, elementConverter);
|
|
return result;
|
|
}
|
|
|
|
public static byte2 Pack(in uint2 vector, Func<uint, byte> elementConverter)
|
|
{
|
|
VectorPack.Pack(vector, out byte2 result, elementConverter);
|
|
return result;
|
|
}
|
|
|
|
public static byte2 Pack(in float2 vector, Func<float, byte> elementConverter)
|
|
{
|
|
VectorPack.Pack(vector, out byte2 result, elementConverter);
|
|
return result;
|
|
}
|
|
|
|
public static byte2 Pack(in double2 vector, Func<double, byte> elementConverter)
|
|
{
|
|
VectorPack.Pack(vector, out byte2 result, elementConverter);
|
|
return result;
|
|
}
|
|
|
|
public static byte2 Unpack(in sbyte2 vector, Unpack.IntegerMixed mode = Numerics.Unpack.IntegerMixed.Cast)
|
|
{
|
|
return Unpack(vector, PackUtils.SByte.ToByte(mode));
|
|
}
|
|
|
|
public static byte2 Pack(in short2 vector, Pack.IntegerMixed mode = Numerics.Pack.IntegerMixed.Cast)
|
|
{
|
|
return Pack(vector, PackUtils.Short.ToByte(mode));
|
|
}
|
|
|
|
public static byte2 Pack(in ushort2 vector, Pack.Integer mode = Numerics.Pack.Integer.Cast)
|
|
{
|
|
return Pack(vector, PackUtils.UShort.ToByte(mode));
|
|
}
|
|
|
|
public static byte2 Pack(in int2 vector, Pack.IntegerMixed mode = Numerics.Pack.IntegerMixed.Cast)
|
|
{
|
|
return Pack(vector, PackUtils.Int.ToByte(mode));
|
|
}
|
|
|
|
public static byte2 Pack(in uint2 vector, Pack.Integer mode = Numerics.Pack.Integer.Cast)
|
|
{
|
|
return Pack(vector, PackUtils.UInt.ToByte(mode));
|
|
}
|
|
|
|
public static byte2 Pack(in float2 vector, Pack.Float mode = Numerics.Pack.Float.Truncate)
|
|
{
|
|
return Pack(vector, PackUtils.Float.ToByte(mode));
|
|
}
|
|
|
|
public static byte2 Pack(in double2 vector, Pack.Float mode = Numerics.Pack.Float.Truncate)
|
|
{
|
|
return Pack(vector, PackUtils.Double.ToByte(mode));
|
|
}
|
|
|
|
public static void UnpackSpan(
|
|
in ReadOnlySpan<sbyte2> source,
|
|
Span<byte2> destination,
|
|
Func<sbyte, byte> elementConverter
|
|
)
|
|
{
|
|
VectorPack.Pack(source, destination, elementConverter);
|
|
}
|
|
|
|
public static void PackSpan(
|
|
in ReadOnlySpan<short2> source,
|
|
Span<byte2> destination,
|
|
Func<short, byte> elementConverter
|
|
)
|
|
{
|
|
VectorPack.Pack(source, destination, elementConverter);
|
|
}
|
|
|
|
public static void PackSpan(
|
|
in ReadOnlySpan<ushort2> source,
|
|
Span<byte2> destination,
|
|
Func<ushort, byte> elementConverter
|
|
)
|
|
{
|
|
VectorPack.Pack(source, destination, elementConverter);
|
|
}
|
|
|
|
public static void PackSpan(
|
|
in ReadOnlySpan<int2> source,
|
|
Span<byte2> destination,
|
|
Func<int, byte> elementConverter
|
|
)
|
|
{
|
|
VectorPack.Pack(source, destination, elementConverter);
|
|
}
|
|
|
|
public static void PackSpan(
|
|
in ReadOnlySpan<uint2> source,
|
|
Span<byte2> destination,
|
|
Func<uint, byte> elementConverter
|
|
)
|
|
{
|
|
VectorPack.Pack(source, destination, elementConverter);
|
|
}
|
|
|
|
public static void PackSpan(
|
|
in ReadOnlySpan<float2> source,
|
|
Span<byte2> destination,
|
|
Func<float, byte> elementConverter
|
|
)
|
|
{
|
|
VectorPack.Pack(source, destination, elementConverter);
|
|
}
|
|
|
|
public static void PackSpan(
|
|
in ReadOnlySpan<double2> source,
|
|
Span<byte2> destination,
|
|
Func<double, byte> elementConverter
|
|
)
|
|
{
|
|
VectorPack.Pack(source, destination, elementConverter);
|
|
}
|
|
|
|
public static void UnpackSpan(
|
|
in ReadOnlySpan<sbyte2> source,
|
|
Span<byte2> destination,
|
|
Unpack.IntegerMixed mode = Numerics.Unpack.IntegerMixed.Cast
|
|
)
|
|
{
|
|
UnpackSpan(source, destination, PackUtils.SByte.ToByte(mode));
|
|
}
|
|
|
|
public static void PackSpan(
|
|
in ReadOnlySpan<short2> source,
|
|
Span<byte2> destination,
|
|
Pack.IntegerMixed mode = Numerics.Pack.IntegerMixed.Cast
|
|
)
|
|
{
|
|
PackSpan(source, destination, PackUtils.Short.ToByte(mode));
|
|
}
|
|
|
|
public static void PackSpan(
|
|
in ReadOnlySpan<ushort2> source,
|
|
Span<byte2> destination,
|
|
Pack.Integer mode = Numerics.Pack.Integer.Cast
|
|
)
|
|
{
|
|
PackSpan(source, destination, PackUtils.UShort.ToByte(mode));
|
|
}
|
|
|
|
public static void PackSpan(
|
|
in ReadOnlySpan<int2> source,
|
|
Span<byte2> destination,
|
|
Pack.IntegerMixed mode = Numerics.Pack.IntegerMixed.Cast
|
|
)
|
|
{
|
|
PackSpan(source, destination, PackUtils.Int.ToByte(mode));
|
|
}
|
|
|
|
public static void PackSpan(
|
|
in ReadOnlySpan<uint2> source,
|
|
Span<byte2> destination,
|
|
Pack.Integer mode = Numerics.Pack.Integer.Cast
|
|
)
|
|
{
|
|
PackSpan(source, destination, PackUtils.UInt.ToByte(mode));
|
|
}
|
|
|
|
public static void PackSpan(
|
|
in ReadOnlySpan<float2> source,
|
|
Span<byte2> destination,
|
|
Pack.Float mode = Numerics.Pack.Float.Truncate
|
|
)
|
|
{
|
|
PackSpan(source, destination, PackUtils.Float.ToByte(mode));
|
|
}
|
|
|
|
public static void PackSpan(
|
|
in ReadOnlySpan<double2> source,
|
|
Span<byte2> destination,
|
|
Pack.Float mode = Numerics.Pack.Float.Truncate
|
|
)
|
|
{
|
|
PackSpan(source, destination, PackUtils.Double.ToByte(mode));
|
|
}
|
|
}
|