NewTOAPIA.Net.Rtp.GF16.fillLogTables C# (CSharp) Method

fillLogTables() private static method

Fill the log table. The log tables are used to facilitate multiplication and division.
private static fillLogTables ( ) : void
return void
        private static void fillLogTables()
        {
            UInt32 mask = 1;
            for (UInt16 i = 0; i < UInt16.MaxValue; i++)
            {
                ALog[i] = (UInt16)mask;
                Log[mask] = i;

                mask <<= 1;
                if ((mask & GF) != 0)
                    mask = mask ^ PrimePolynomial;
            }

            // set the extended gf_exp values for fast multiply
            for (UInt32 i = 0; i < UInt16.MaxValue; i++)
                ALog[i + UInt16.MaxValue] = ALog[i];

            inverse[0] = 0;
            inverse[1] = 1;
            for (UInt32 i = 2; i <= UInt16.MaxValue; i++)
                inverse[i] = ALog[UInt16.MaxValue - Log[i]];
        }