fix M512 member index bug
This commit is contained in:
@@ -2,8 +2,8 @@
|
|||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// file="M512"
|
// file="M512"
|
||||||
// Project: StgSharp
|
// Project: StgSharp
|
||||||
// AuthorGroup: Nitload Space
|
// AuthorGroup: Nitload
|
||||||
// Copyright (c) Nitload Space. All rights reserved.
|
// Copyright (c) Nitload. All rights reserved.
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// of this software and associated documentation files (the "Software"), to deal
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -44,19 +44,23 @@ namespace StgSharp.HighPerformance.ProcessorAbstraction
|
|||||||
[FieldOffset(0)] private fixed byte _buffer[64];
|
[FieldOffset(0)] private fixed byte _buffer[64];
|
||||||
[FieldOffset(0)] private Vector512<float> Vec;
|
[FieldOffset(0)] private Vector512<float> Vec;
|
||||||
|
|
||||||
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]);
|
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 = Vector512.Create(value).AsSingle();
|
Vec = Vector512.Create(value).AsSingle();
|
||||||
}
|
}
|
||||||
|
|
||||||
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[0]);
|
return ref Unsafe.As<byte, T>(ref _buffer[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user