frostfs-sdk-csharp/src/FrostFS.SDK.Cryptography/ArrayHelper.cs
p.gross 0c4723c705 [#3] Move to netstandard 2.0
Signed-off-by: Pavel Gross <p.gross@yadro.com>
2024-05-30 11:47:51 +03:00

24 lines
No EOL
551 B
C#

using System;
using System.Linq;
using System.Runtime.CompilerServices;
namespace FrostFS.SDK.Cryptography;
internal static class ArrayHelper
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static byte[] Concat(params byte[][] buffers)
{
var length = buffers.Sum(buffer => buffer.Length);
var dst = new byte[length];
var p = 0;
foreach (var src in buffers)
{
Buffer.BlockCopy(src, 0, dst, p, src.Length);
p += src.Length;
}
return dst;
}
}