@@ -337,13 +337,13 @@ static const uint8_t integer_of_trits[3][3][3][3][3] {
337337struct btq_count
338338{
339339 /* * @brief The number of bits. */
340- uint8_t bits;
340+ uint8_t bits: 6 ;
341341
342342 /* * @brief The number of trits. */
343- uint8_t trits;
343+ uint8_t trits: 1 ;
344344
345345 /* * @brief The number of quints. */
346- uint8_t quints;
346+ uint8_t quints: 1 ;
347347};
348348
349349/* *
@@ -382,37 +382,37 @@ static const std::array<btq_count, 21> btq_counts {{
382382struct ise_size
383383{
384384 /* * @brief The scaling parameter. */
385- uint8_t scale;
385+ uint8_t scale: 6 ;
386386
387387 /* * @brief The divisor parameter. */
388- uint8_t divisor;
388+ uint8_t divisor: 2 ;
389389};
390390
391391/* *
392392 * @brief The table of scale, round, and divisors needed for quant sizing.
393393 */
394394static const std::array<ise_size, 21 > ise_sizes {{
395- { 1 , 1 }, // QUANT_2
396- { 8 , 5 }, // QUANT_3
397- { 2 , 1 }, // QUANT_4
398- { 7 , 3 }, // QUANT_5
399- { 13 , 5 }, // QUANT_6
400- { 3 , 1 }, // QUANT_8
401- { 10 , 3 }, // QUANT_10
402- { 18 , 5 }, // QUANT_12
403- { 4 , 1 }, // QUANT_16
404- { 13 , 3 }, // QUANT_20
405- { 23 , 5 }, // QUANT_24
406- { 5 , 1 }, // QUANT_32
407- { 16 , 3 }, // QUANT_40
408- { 28 , 5 }, // QUANT_48
409- { 6 , 1 }, // QUANT_64
410- { 19 , 3 }, // QUANT_80
411- { 33 , 5 }, // QUANT_96
412- { 7 , 1 }, // QUANT_128
413- { 22 , 3 }, // QUANT_160
414- { 38 , 5 }, // QUANT_192
415- { 8 , 1 } // QUANT_256
395+ { 1 , 0 }, // QUANT_2
396+ { 8 , 2 }, // QUANT_3
397+ { 2 , 0 }, // QUANT_4
398+ { 7 , 1 }, // QUANT_5
399+ { 13 , 2 }, // QUANT_6
400+ { 3 , 0 }, // QUANT_8
401+ { 10 , 1 }, // QUANT_10
402+ { 18 , 2 }, // QUANT_12
403+ { 4 , 0 }, // QUANT_16
404+ { 13 , 1 }, // QUANT_20
405+ { 23 , 2 }, // QUANT_24
406+ { 5 , 0 }, // QUANT_32
407+ { 16 , 1 }, // QUANT_40
408+ { 28 , 2 }, // QUANT_48
409+ { 6 , 0 }, // QUANT_64
410+ { 19 , 1 }, // QUANT_80
411+ { 33 , 2 }, // QUANT_96
412+ { 7 , 0 }, // QUANT_128
413+ { 22 , 1 }, // QUANT_160
414+ { 38 , 2 }, // QUANT_192
415+ { 8 , 0 } // QUANT_256
416416}};
417417
418418/* See header for documentation. */
@@ -428,7 +428,8 @@ unsigned int get_ise_sequence_bitcount(
428428 }
429429
430430 auto & entry = ise_sizes[quant_level];
431- return (entry.scale * character_count + entry.divisor - 1 ) / entry.divisor ;
431+ unsigned int divisor = (entry.divisor << 1 ) + 1 ;
432+ return (entry.scale * character_count + divisor - 1 ) / divisor;
432433}
433434
434435/* *
@@ -678,10 +679,10 @@ void decode_ise(
678679
679680 if (trits)
680681 {
681- static const unsigned int bits_to_read[5 ] { 2 , 2 , 1 , 2 , 1 };
682- static const unsigned int block_shift[5 ] { 0 , 2 , 4 , 5 , 7 };
683- static const unsigned int next_lcounter[5 ] { 1 , 2 , 3 , 4 , 0 };
684- static const unsigned int hcounter_incr[5 ] { 0 , 0 , 0 , 0 , 1 };
682+ static const uint8_t bits_to_read[5 ] { 2 , 2 , 1 , 2 , 1 };
683+ static const uint8_t block_shift[5 ] { 0 , 2 , 4 , 5 , 7 };
684+ static const uint8_t next_lcounter[5 ] { 1 , 2 , 3 , 4 , 0 };
685+ static const uint8_t hcounter_incr[5 ] { 0 , 0 , 0 , 0 , 1 };
685686 unsigned int tdata = read_bits (bits_to_read[lcounter], bit_offset, input_data);
686687 bit_offset += bits_to_read[lcounter];
687688 tq_blocks[hcounter] |= tdata << block_shift[lcounter];
@@ -691,10 +692,10 @@ void decode_ise(
691692
692693 if (quints)
693694 {
694- static const unsigned int bits_to_read[3 ] { 3 , 2 , 2 };
695- static const unsigned int block_shift[3 ] { 0 , 3 , 5 };
696- static const unsigned int next_lcounter[3 ] { 1 , 2 , 0 };
697- static const unsigned int hcounter_incr[3 ] { 0 , 0 , 1 };
695+ static const uint8_t bits_to_read[3 ] { 3 , 2 , 2 };
696+ static const uint8_t block_shift[3 ] { 0 , 3 , 5 };
697+ static const uint8_t next_lcounter[3 ] { 1 , 2 , 0 };
698+ static const uint8_t hcounter_incr[3 ] { 0 , 0 , 1 };
698699 unsigned int tdata = read_bits (bits_to_read[lcounter], bit_offset, input_data);
699700 bit_offset += bits_to_read[lcounter];
700701 tq_blocks[hcounter] |= tdata << block_shift[lcounter];
0 commit comments