/// <summary> /// Initializes the implementation details of a <see cref="CyclicRedundancyCheck"/> related polynomial lookup table. /// </summary> /// <param name="currentBit">The current bit ranging from 0 to 7.</param> /// <param name="currentTableIndex">The current index of the associated polynomial <see cref="CyclicRedundancyCheck.LookupTable"/> ranging from 0 to 255.</param> /// <remarks>This method is - on first run - invoked 8 times per entry in the associated polynomial <see cref="CyclicRedundancyCheck.LookupTable"/>, given a total of 2048 times.</remarks> protected override void InitializePolynomialLookupTable(byte currentBit, ushort currentTableIndex) { bool hasIndex = ListUtility.HasIndex(currentTableIndex, LookupTable); if (!hasIndex) { LookupTable.Add(currentTableIndex); } long value = LookupTable[currentTableIndex]; if ((value & 1) == 1) { value = (value >> 1) ^ Polynomial; } else { value >>= 1; } LookupTable[currentTableIndex] = value; }