Fix some things

This commit is contained in:
2019-04-27 11:01:38 +02:00
parent 86593eff22
commit f67d070fc3
6 changed files with 286 additions and 187 deletions

View File

@@ -36,10 +36,20 @@ namespace PlantBox.Broker
{
double[] FillArray(double[] values, int length)
{
var array = new double[length];
int startIndex = length - values.Length;
// Check if need
if (values.Length >= length)
{
return values.Reverse().Take(length).Reverse().ToArray();
}
values.CopyTo(array, startIndex);
var array = new double[length];
if (values.Length > 0)
{
int startIndex = length - values.Length;
values.CopyTo(array, startIndex);
}
return array;
}