// A variation of/optimization over Hamming Code (39,32) // For explenation on parity-check matrix construction see: // https://www.ysu.am/files/11-1549527438-.pdf public static ulong AddECC(uint word) { var code = 0ul; for (byte i = 0; i < 7; ++i) { BitHelper.SetBit(ref code, i, BitHelper.CalculateParity(word & bitmask[i])); } return((ulong)word | (code << 32)); }