Beispiel #1
0
        /// <summary>
        /// Append length info. On success, store the result in "bits".
        /// </summary>
        /// <param name="numLetters">The num letters.</param>
        /// <param name="version">The version.</param>
        /// <param name="mode">The mode.</param>
        /// <param name="bits">The bits.</param>
        internal static void AppendLengthInfo(int numLetters, Version version, Mode mode, BitArray bits)
        {
            int numBits = mode.GetCharacterCountBits(version);

            if (numLetters >= (1 << numBits))
            {
                throw new WriterException(numLetters + " is bigger than " + ((1 << numBits) - 1));
            }
            bits.appendBits(numLetters, numBits);
        }
Beispiel #2
0
 private static int CalculateBitsNeeded(Mode mode, BitArray headerBits, BitArray dataBits, Version version)
 {
     return(headerBits.Size + mode.GetCharacterCountBits(version) + dataBits.Size);
 }