merge to main stream
This commit is contained in:
+2
-2
@@ -32,7 +32,7 @@ using System.Numerics;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Mathematics
|
||||
namespace StgSharp.HighPerformance.ProcessorAbstraction
|
||||
{
|
||||
/// <summary>
|
||||
/// Abstraction for a wide SIMD register or equivalent packed numeric storage. Provides raw
|
||||
@@ -95,4 +95,4 @@ namespace StgSharp.Mathematics
|
||||
ref T Member<T>(int index) where T: unmanaged, INumber<T>;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -36,7 +36,7 @@ using System.Runtime.Intrinsics.X86;
|
||||
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Mathematics
|
||||
namespace StgSharp.HighPerformance.ProcessorAbstraction
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit, Pack = 16)]
|
||||
public unsafe struct M128 : IRegisterPresentation
|
||||
+1
-1
@@ -35,7 +35,7 @@ using System.Runtime.Intrinsics;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Mathematics
|
||||
namespace StgSharp.HighPerformance.ProcessorAbstraction
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit, Pack = 16)]
|
||||
public unsafe struct M256 : IRegisterPresentation
|
||||
+1
-1
@@ -35,7 +35,7 @@ using System.Runtime.Intrinsics;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Mathematics
|
||||
namespace StgSharp.HighPerformance.ProcessorAbstraction
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit, Size = 64, Pack = 64)]
|
||||
public unsafe struct M512 : IRegisterPresentation
|
||||
+33
-14
@@ -2,8 +2,8 @@
|
||||
// -----------------------------------------------------------------------
|
||||
// file="M64"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
// AuthorGroup: Nitload
|
||||
// Copyright (c) Nitload. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -30,7 +30,7 @@ using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Intrinsics;
|
||||
|
||||
namespace StgSharp.Mathematics
|
||||
namespace StgSharp.HighPerformance.ProcessorAbstraction
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit, Pack = 8)]
|
||||
public unsafe struct M64 : IRegisterPresentation
|
||||
@@ -47,17 +47,21 @@ namespace StgSharp.Mathematics
|
||||
Unsafe.SkipInit(out value);
|
||||
}
|
||||
|
||||
public ref T AsRef<T>() where T: unmanaged,INumber<T>
|
||||
public ref T AsRef<T>() where T : unmanaged,INumber<T>
|
||||
{
|
||||
return ref Unsafe.As<byte, T>(ref buffer[0]);
|
||||
}
|
||||
|
||||
public void BroadCastFrom<T>(T value) where T: unmanaged, INumber<T>
|
||||
public void BroadCastFrom<T>(
|
||||
T value
|
||||
) where T : unmanaged, INumber<T>
|
||||
{
|
||||
vec = Vector64.Create(value).AsSingle();
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
public override bool Equals(
|
||||
object obj
|
||||
)
|
||||
{
|
||||
return obj is M64 m64 && this == m64;
|
||||
}
|
||||
@@ -68,32 +72,47 @@ namespace StgSharp.Mathematics
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public ref T Member<T>(int index) where T: unmanaged, INumber<T>
|
||||
public ref T Member<T>(
|
||||
int index
|
||||
) where T : unmanaged, INumber<T>
|
||||
{
|
||||
return ref Unsafe.As<byte, T>(ref buffer[index * sizeof(T)]);
|
||||
}
|
||||
|
||||
public static bool operator !=(M64 left, M64 right)
|
||||
public static bool operator !=(
|
||||
M64 left,
|
||||
M64 right
|
||||
)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
public static M64 operator <<(M64 value, int shift)
|
||||
public static M64 operator <<(
|
||||
M64 value,
|
||||
int shift
|
||||
)
|
||||
{
|
||||
M64 result = new M64();
|
||||
result.value = value.value << shift;
|
||||
return result;
|
||||
}
|
||||
|
||||
public static bool operator ==(M64 left, M64 right)
|
||||
public static bool operator ==(
|
||||
M64 left,
|
||||
M64 right
|
||||
)
|
||||
{
|
||||
return left.value == right.value;
|
||||
}
|
||||
public static M64 operator >>(M64 value, int shift)
|
||||
public static M64 operator >>(
|
||||
M64 value,
|
||||
int shift
|
||||
)
|
||||
{
|
||||
M64 result = new M64();
|
||||
result.value = value.value << shift;
|
||||
return result;
|
||||
return new()
|
||||
{
|
||||
value = value.value << shift
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="HighPerformance\RegisterAbstraction\" />
|
||||
<Folder Include="HighPerformance\ProcessorAbstraction\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user