mirror of
https://github.com/evopro-ag/Sharp7Reactive.git
synced 2025-12-16 11:42:52 +00:00
Switch ReadFromBuffer to span
This commit is contained in:
@@ -9,7 +9,7 @@ internal abstract class ConverterTestBase
|
||||
|
||||
public static MethodInfo CreateReadMethod(ConverterTestCase tc)
|
||||
{
|
||||
var convertMi = typeof(ValueConverter).GetMethod(nameof(ValueConverter.ReadFromBuffer));
|
||||
var convertMi = typeof(ConverterTestBase).GetMethod(nameof(ReadFromBuffer));
|
||||
var convert = convertMi!.MakeGenericMethod(tc.Value.GetType());
|
||||
return convert;
|
||||
}
|
||||
@@ -67,12 +67,17 @@ internal abstract class ConverterTestBase
|
||||
|
||||
/// <summary>
|
||||
/// This helper method exists, since I could not manage to invoke a generic method
|
||||
/// accepring a Span<T> as parameter.
|
||||
/// with a Span<T> parameter.
|
||||
/// </summary>
|
||||
public static void WriteToBuffer<TValue>(byte[] buffer, TValue value, VariableAddress address)
|
||||
{
|
||||
public static void WriteToBuffer<TValue>(byte[] buffer, TValue value, VariableAddress address) =>
|
||||
ValueConverter.WriteToBuffer(buffer, value, address);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This helper method exists, since I could not manage to invoke a generic method
|
||||
/// with a Span<T> parameter.
|
||||
/// </summary>
|
||||
public static TValue ReadFromBuffer<TValue>(byte[] buffer, VariableAddress address) =>
|
||||
ValueConverter.ReadFromBuffer<TValue>(buffer, address);
|
||||
|
||||
public record ConverterTestCase(object Value, string Address, byte[] Data)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user