public static unsafe byte[] Syndrome2Parity(ushort[,] syndrome, byte[] parity = null) { var stride = syndrome.GetLength(0); var npar = syndrome.GetLength(1); var converter = new ParityToSyndrome(npar); if (parity == null) parity = new byte[npar * stride * 2]; fixed (byte* bpar = parity) fixed (ushort* syn = syndrome) { ushort* par = (ushort*)bpar; for (int i = 0; i < stride; i++) converter.Syndrome2Parity(syn + i * npar, par + i * npar); } return parity; }
public static unsafe byte[] Syndrome2Parity(ushort[,] syndrome, byte[] parity = null) { var stride = syndrome.GetLength(0); var npar = syndrome.GetLength(1); var converter = new ParityToSyndrome(npar); if (parity == null) { parity = new byte[npar * stride * 2]; fixed(byte *bpar = parity) fixed(ushort *syn = syndrome) { ushort *par = (ushort *)bpar; for (int i = 0; i < stride; i++) { converter.Syndrome2Parity(syn + i * npar, par + i * npar); } } return(parity); }