text: /**
      Copyright (c) 2017 Vicente Romero. All rights reserved.
      Licensed under the MIT License.
      See LICENSE file in the project root for full license information.
  */
  
  #ifndef ENCODE_H_
  #define ENCODE_H_
  
  #include <cstdint>
  
  #include "constants.h"
  
  struct EncodedSymbol {
      uint16_t symbol;
      uint8_t enc_bit_length;
      uint16_t enc_value;
  
      EncodedSymbol() : symbol(0), enc_bit_length(0), enc_value(0) {}
  
      EncodedSymbol(uint16_t s) : symbol(s), enc_bit_length(0), enc_value(0) {}
  
      EncodedSymbol(uint16_t s, uint8_t len, uint16_t enc_s) :
          symbol(s), enc_bit_length(len), enc_value(enc_s) {}
  
  };
  
  static const uint8_t kStaticBitLengths[kBlockMaxEncodingSymbols] = {
       5,  1,  2,  3,  3,  3,  4,  4,  4,  5,  5,  5,  5,  5,  5,  5,
       6,  6,  6,  6,  6,  6,  6,  7,  7,  7,  7,  7,  7,  7,  7,  7,
       7,  7,  7,  7,  7,  7,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,
       8,  8,  8,  8,  8,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
       9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
       9,  9,  9,  9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
      10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
      10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
      11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
      11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
      11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
      11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
      12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
      12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
      12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
      12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13
  };
  
  #endif // ENCODE_H_
  
  