Exemplo n.º 1
0
        /// <summary>
        /// Converts a provided <see cref="NumeralString"/> to a <see cref="BitString"/>.
        ///
        /// Numerals within the <see cref="NumeralString"/> are int (16 bits) and are converted
        /// to bits and concatenated onto a <see cref="BitString"/> then returned.
        /// </summary>
        /// <param name="numeralString">The <see cref="NumeralString"/> to convert.</param>
        /// <returns>The <see cref="BitString"/> representation of a <see cref="NumeralString"/>.</returns>
        public static BitString ToBitString(NumeralString numeralString)
        {
            var bs = new BitString(0);

            foreach (var number in numeralString.Numbers)
            {
                bs = bs.ConcatenateBits(BitString.To32BitString(number).GetLeastSignificantBits(16));
            }

            return(bs);
        }