public static byte[] Multiply(this byte[] A, byte[] B)
{
List<byte> ans = new List<byte>();
byte ov, res;
int idx = 0;
for (int i = 0; i < A.Length; i++)
{
ov = 0;
for (int j = 0; j < B.Length; j++)
{
short result = (short)(A[i] * B[j] + ov);
ov = (byte)(result >> ;
res = (byte)result;
idx = i + j;
if (idx < (ans.Count))
ans = _add_(ans, res, idx);
else ans.Add(res);
}
if (ov > 0)
if (idx + 1 < (ans.Count))
ans = _add_(ans, ov, idx + 1);
else ans.Add(ov);
}
return ans.ToArray();
}
Copyright © 2024, NextGenUpdate.
All Rights Reserved.