本文整理汇总了C#中MyMemoryBlock.CopyFromMemoryBlock方法的典型用法代码示例。如果您正苦于以下问题:C# MyMemoryBlock.CopyFromMemoryBlock方法的具体用法?C# MyMemoryBlock.CopyFromMemoryBlock怎么用?C# MyMemoryBlock.CopyFromMemoryBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyMemoryBlock
的用法示例。
在下文中一共展示了MyMemoryBlock.CopyFromMemoryBlock方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public void Run(MyStackingOperation operation, MyMemoryBlock<float> output, IEnumerable<MyMemoryBlock<float>> inputs)
{
if (inputs == null || !inputs.Any())
{
MyLog.WARNING.WriteLine("No inputs for stacking operation to run on. Owner: " + m_caller.Name);
return;
}
inputs = inputs.Where(a => a != null);
if (m_forceInputChecking && !ValidateAtRun(operation, inputs, output))
return;
switch (operation)
{
case MyStackingOperation.Concatenate:
{
int resPtr = 0;
foreach (MyMemoryBlock<float> input in inputs)
{
output.CopyFromMemoryBlock(input, 0, resPtr, input.Count);
resPtr += input.Count;
}
}
break;
case MyStackingOperation.Interweave:
{
int i = 0;
int resPtr = 0;
MyMemoryBlock<float> first = inputs.First();
int rows = first.Count / first.ColumnHint;
// Alter between copying the inputs, up to the last row
for (; i < rows - 1; i++)
{
foreach (MyMemoryBlock<float> input in inputs)
{
output.CopyFromMemoryBlock(input, i * input.ColumnHint, resPtr, input.ColumnHint);
resPtr += input.ColumnHint;
}
}
// Copy the last rows - they are not guaranteed to be input.ColumnHint wide!
foreach (MyMemoryBlock<float> input in inputs)
{
int lastRowIdx = i * input.ColumnHint;
int lastRowSize = input.Count - lastRowIdx;
if (lastRowSize > 0)
{
output.CopyFromMemoryBlock(input, lastRowIdx, resPtr, lastRowSize);
resPtr += lastRowSize;
}
}
}
break;
}
}