LCOV - code coverage report
Current view: top level - ballet/reedsol - fd_reedsol_encode_16.c (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 113 180 62.8 %
Date: 2024-11-13 11:58:15 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /* Note: This file is auto generated. */
       2             : #include "fd_reedsol_ppt.h"
       3             : 
       4             : FD_FN_UNSANITIZED void
       5             : fd_reedsol_private_encode_16( ulong                 shred_sz,
       6             :                               uchar const * const * data_shred,
       7             :                               ulong                 data_shred_cnt,
       8             :                               uchar       * const * parity_shred,
       9       47760 :                               ulong                 parity_shred_cnt ) {
      10     1603485 :   for( ulong shred_pos=0UL; shred_pos<shred_sz; /* advanced manually at end of loop */ ) {
      11     1555725 :     gf_t in00 = gf_zero();  gf_t in01 = gf_zero();  gf_t in02 = gf_zero();  gf_t in03 = gf_zero();
      12     1555725 :     gf_t in04 = gf_zero();  gf_t in05 = gf_zero();  gf_t in06 = gf_zero();  gf_t in07 = gf_zero();
      13     1555725 :     gf_t in08 = gf_zero();  gf_t in09 = gf_zero();  gf_t in10 = gf_zero();  gf_t in11 = gf_zero();
      14     1555725 :     gf_t in12 = gf_zero();  gf_t in13 = gf_zero();  gf_t in14 = gf_zero();  gf_t in15 = gf_zero();
      15     1555725 :     switch( data_shred_cnt ) {
      16       95520 :       case 16UL: in15 = gf_ldu( data_shred[ 15 ] + shred_pos ); FALLTHRU
      17      191040 :       case 15UL: in14 = gf_ldu( data_shred[ 14 ] + shred_pos ); FALLTHRU
      18      286560 :       case 14UL: in13 = gf_ldu( data_shred[ 13 ] + shred_pos ); FALLTHRU
      19      382080 :       case 13UL: in12 = gf_ldu( data_shred[ 12 ] + shred_pos ); FALLTHRU
      20      477600 :       case 12UL: in11 = gf_ldu( data_shred[ 11 ] + shred_pos ); FALLTHRU
      21      573120 :       case 11UL: in10 = gf_ldu( data_shred[ 10 ] + shred_pos ); FALLTHRU
      22      651360 :       case 10UL: in09 = gf_ldu( data_shred[  9 ] + shred_pos ); FALLTHRU
      23      751845 :       case  9UL: in08 = gf_ldu( data_shred[  8 ] + shred_pos ); FALLTHRU
      24      852330 :       case  8UL: in07 = gf_ldu( data_shred[  7 ] + shred_pos ); FALLTHRU
      25      952815 :       case  7UL: in06 = gf_ldu( data_shred[  6 ] + shred_pos ); FALLTHRU
      26     1053300 :       case  6UL: in05 = gf_ldu( data_shred[  5 ] + shred_pos ); FALLTHRU
      27     1153785 :       case  5UL: in04 = gf_ldu( data_shred[  4 ] + shred_pos ); FALLTHRU
      28     1254270 :       case  4UL: in03 = gf_ldu( data_shred[  3 ] + shred_pos ); FALLTHRU
      29     1354755 :       case  3UL: in02 = gf_ldu( data_shred[  2 ] + shred_pos ); FALLTHRU
      30     1455240 :       case  2UL: in01 = gf_ldu( data_shred[  1 ] + shred_pos ); FALLTHRU
      31     1555725 :       case  1UL: in00 = gf_ldu( data_shred[  0 ] + shred_pos );
      32     1555725 :     }
      33     1555725 :     #define ALL_VARS in00, in01, in02, in03, in04, in05, in06, in07, in08, in09, in10, in11, in12, in13, in14, in15
      34     1555725 :     switch( data_shred_cnt ) {
      35       95520 :       case 16UL: FD_REEDSOL_GENERATE_IFFT( 16,  0, ALL_VARS ); break;
      36       95520 :       case 15UL: FD_REEDSOL_GENERATE_PPT(  16, 15, ALL_VARS ); break;
      37       95520 :       case 14UL: FD_REEDSOL_GENERATE_PPT(  16, 14, ALL_VARS ); break;
      38       95520 :       case 13UL: FD_REEDSOL_GENERATE_PPT(  16, 13, ALL_VARS ); break;
      39       95520 :       case 12UL: FD_REEDSOL_GENERATE_PPT(  16, 12, ALL_VARS ); break;
      40       95520 :       case 11UL: FD_REEDSOL_GENERATE_PPT(  16, 11, ALL_VARS ); break;
      41       78240 :       case 10UL: FD_REEDSOL_GENERATE_PPT(  16, 10, ALL_VARS ); break;
      42      100485 :       case  9UL: FD_REEDSOL_GENERATE_PPT(  16,  9, ALL_VARS ); break;
      43      100485 :       case  8UL: FD_REEDSOL_GENERATE_PPT(  16,  8, ALL_VARS ); break;
      44      100485 :       case  7UL: FD_REEDSOL_GENERATE_PPT(  16,  7, ALL_VARS ); break;
      45      100485 :       case  6UL: FD_REEDSOL_GENERATE_PPT(  16,  6, ALL_VARS ); break;
      46      100485 :       case  5UL: FD_REEDSOL_GENERATE_PPT(  16,  5, ALL_VARS ); break;
      47      100485 :       case  4UL: FD_REEDSOL_GENERATE_PPT(  16,  4, ALL_VARS ); break;
      48      100485 :       case  3UL: FD_REEDSOL_GENERATE_PPT(  16,  3, ALL_VARS ); break;
      49      100485 :       case  2UL: FD_REEDSOL_GENERATE_PPT(  16,  2, ALL_VARS ); break;
      50      100485 :       case  1UL: FD_REEDSOL_GENERATE_PPT(  16,  1, ALL_VARS ); break;
      51     1555725 :     }
      52             :     /* That generated the first 16-data_shred_cnt parity shreds in the
      53             :        last 16-data_shred_cnt variables. We might only need
      54             :        parity_shred_cnt of them though. */
      55     1555725 :     ulong total_shreds = data_shred_cnt+parity_shred_cnt;
      56     1555725 :     switch( data_shred_cnt ) {
      57      100485 :       case  1UL: if( total_shreds <=  1UL ) break; gf_stu( parity_shred[  1UL-data_shred_cnt ] + shred_pos, in01 ); in01 = gf_zero(); FALLTHRU
      58      200970 :       case  2UL: if( total_shreds <=  2UL ) break; gf_stu( parity_shred[  2UL-data_shred_cnt ] + shred_pos, in02 ); in02 = gf_zero(); FALLTHRU
      59      301455 :       case  3UL: if( total_shreds <=  3UL ) break; gf_stu( parity_shred[  3UL-data_shred_cnt ] + shred_pos, in03 ); in03 = gf_zero(); FALLTHRU
      60      401940 :       case  4UL: if( total_shreds <=  4UL ) break; gf_stu( parity_shred[  4UL-data_shred_cnt ] + shred_pos, in04 ); in04 = gf_zero(); FALLTHRU
      61      502425 :       case  5UL: if( total_shreds <=  5UL ) break; gf_stu( parity_shred[  5UL-data_shred_cnt ] + shred_pos, in05 ); in05 = gf_zero(); FALLTHRU
      62      602910 :       case  6UL: if( total_shreds <=  6UL ) break; gf_stu( parity_shred[  6UL-data_shred_cnt ] + shred_pos, in06 ); in06 = gf_zero(); FALLTHRU
      63      703395 :       case  7UL: if( total_shreds <=  7UL ) break; gf_stu( parity_shred[  7UL-data_shred_cnt ] + shred_pos, in07 ); in07 = gf_zero(); FALLTHRU
      64      803880 :       case  8UL: if( total_shreds <=  8UL ) break; gf_stu( parity_shred[  8UL-data_shred_cnt ] + shred_pos, in08 ); in08 = gf_zero(); FALLTHRU
      65      904365 :       case  9UL: if( total_shreds <=  9UL ) break; gf_stu( parity_shred[  9UL-data_shred_cnt ] + shred_pos, in09 ); in09 = gf_zero(); FALLTHRU
      66      982605 :       case 10UL: if( total_shreds <= 10UL ) break; gf_stu( parity_shred[ 10UL-data_shred_cnt ] + shred_pos, in10 ); in10 = gf_zero(); FALLTHRU
      67     1078125 :       case 11UL: if( total_shreds <= 11UL ) break; gf_stu( parity_shred[ 11UL-data_shred_cnt ] + shred_pos, in11 ); in11 = gf_zero(); FALLTHRU
      68     1173645 :       case 12UL: if( total_shreds <= 12UL ) break; gf_stu( parity_shred[ 12UL-data_shred_cnt ] + shred_pos, in12 ); in12 = gf_zero(); FALLTHRU
      69     1269165 :       case 13UL: if( total_shreds <= 13UL ) break; gf_stu( parity_shred[ 13UL-data_shred_cnt ] + shred_pos, in13 ); in13 = gf_zero(); FALLTHRU
      70     1364685 :       case 14UL: if( total_shreds <= 14UL ) break; gf_stu( parity_shred[ 14UL-data_shred_cnt ] + shred_pos, in14 ); in14 = gf_zero(); FALLTHRU
      71     1460205 :       case 15UL: if( total_shreds <= 15UL ) break; gf_stu( parity_shred[ 15UL-data_shred_cnt ] + shred_pos, in15 ); in15 = gf_zero();
      72     1555725 :     }
      73     1555725 :     ulong parity_produced  = fd_ulong_min( 16UL - data_shred_cnt, parity_shred_cnt );
      74     1555725 :     ulong parity_remaining = parity_shred_cnt - parity_produced;
      75     1555725 :     if( FD_UNLIKELY( parity_remaining>0UL ) ) {
      76             :       /* Produce another 16 parity shreds */
      77     1555725 :       FD_REEDSOL_GENERATE_FFT(  16, 16, ALL_VARS );
      78     1555725 :       switch( parity_remaining ) {
      79      651360 :         default:
      80      751845 :         case 16UL: gf_stu( parity_shred[ 15UL+parity_produced ] + shred_pos, in15 ); FALLTHRU
      81      751845 :         case 15UL: gf_stu( parity_shred[ 14UL+parity_produced ] + shred_pos, in14 ); FALLTHRU
      82      852330 :         case 14UL: gf_stu( parity_shred[ 13UL+parity_produced ] + shred_pos, in13 ); FALLTHRU
      83      852330 :         case 13UL: gf_stu( parity_shred[ 12UL+parity_produced ] + shred_pos, in12 ); FALLTHRU
      84      952815 :         case 12UL: gf_stu( parity_shred[ 11UL+parity_produced ] + shred_pos, in11 ); FALLTHRU
      85     1053300 :         case 11UL: gf_stu( parity_shred[ 10UL+parity_produced ] + shred_pos, in10 ); FALLTHRU
      86     1053300 :         case 10UL: gf_stu( parity_shred[  9UL+parity_produced ] + shred_pos, in09 ); FALLTHRU
      87     1153785 :         case  9UL: gf_stu( parity_shred[  8UL+parity_produced ] + shred_pos, in08 ); FALLTHRU
      88     1153785 :         case  8UL: gf_stu( parity_shred[  7UL+parity_produced ] + shred_pos, in07 ); FALLTHRU
      89     1254270 :         case  7UL: gf_stu( parity_shred[  6UL+parity_produced ] + shred_pos, in06 ); FALLTHRU
      90     1354755 :         case  6UL: gf_stu( parity_shred[  5UL+parity_produced ] + shred_pos, in05 ); FALLTHRU
      91     1354755 :         case  5UL: gf_stu( parity_shred[  4UL+parity_produced ] + shred_pos, in04 ); FALLTHRU
      92     1455240 :         case  4UL: gf_stu( parity_shred[  3UL+parity_produced ] + shred_pos, in03 ); FALLTHRU
      93     1455240 :         case  3UL: gf_stu( parity_shred[  2UL+parity_produced ] + shred_pos, in02 ); FALLTHRU
      94     1555725 :         case  2UL: gf_stu( parity_shred[  1UL+parity_produced ] + shred_pos, in01 ); FALLTHRU
      95     1555725 :         case  1UL: gf_stu( parity_shred[  0UL+parity_produced ] + shred_pos, in00 );
      96     1555725 :       }
      97     1555725 :       parity_produced += fd_ulong_min( 16UL, parity_remaining );
      98     1555725 :       parity_remaining = parity_shred_cnt - parity_produced;
      99     1555725 :     }
     100     1555725 :     if( FD_UNLIKELY( parity_remaining>0UL ) ) {
     101             :       /* Produce another 16 parity shreds */
     102      651360 :       FD_REEDSOL_GENERATE_IFFT( 16, 16, ALL_VARS );
     103      651360 :       FD_REEDSOL_GENERATE_FFT(  16, 32, ALL_VARS );
     104      651360 :       switch( parity_remaining ) {
     105           0 :         default:
     106           0 :         case 16UL: gf_stu( parity_shred[ 15UL+parity_produced ] + shred_pos, in15 ); FALLTHRU
     107           0 :         case 15UL: gf_stu( parity_shred[ 14UL+parity_produced ] + shred_pos, in14 ); FALLTHRU
     108           0 :         case 14UL: gf_stu( parity_shred[ 13UL+parity_produced ] + shred_pos, in13 ); FALLTHRU
     109           0 :         case 13UL: gf_stu( parity_shred[ 12UL+parity_produced ] + shred_pos, in12 ); FALLTHRU
     110           0 :         case 12UL: gf_stu( parity_shred[ 11UL+parity_produced ] + shred_pos, in11 ); FALLTHRU
     111           0 :         case 11UL: gf_stu( parity_shred[ 10UL+parity_produced ] + shred_pos, in10 ); FALLTHRU
     112       95520 :         case 10UL: gf_stu( parity_shred[  9UL+parity_produced ] + shred_pos, in09 ); FALLTHRU
     113      191040 :         case  9UL: gf_stu( parity_shred[  8UL+parity_produced ] + shred_pos, in08 ); FALLTHRU
     114      191040 :         case  8UL: gf_stu( parity_shred[  7UL+parity_produced ] + shred_pos, in07 ); FALLTHRU
     115      286560 :         case  7UL: gf_stu( parity_shred[  6UL+parity_produced ] + shred_pos, in06 ); FALLTHRU
     116      382080 :         case  6UL: gf_stu( parity_shred[  5UL+parity_produced ] + shred_pos, in05 ); FALLTHRU
     117      382080 :         case  5UL: gf_stu( parity_shred[  4UL+parity_produced ] + shred_pos, in04 ); FALLTHRU
     118      477600 :         case  4UL: gf_stu( parity_shred[  3UL+parity_produced ] + shred_pos, in03 ); FALLTHRU
     119      573120 :         case  3UL: gf_stu( parity_shred[  2UL+parity_produced ] + shred_pos, in02 ); FALLTHRU
     120      573120 :         case  2UL: gf_stu( parity_shred[  1UL+parity_produced ] + shred_pos, in01 ); FALLTHRU
     121      651360 :         case  1UL: gf_stu( parity_shred[  0UL+parity_produced ] + shred_pos, in00 );
     122      651360 :       }
     123      651360 :       parity_produced += fd_ulong_min( 16UL, parity_remaining );
     124      651360 :       parity_remaining = parity_shred_cnt - parity_produced;
     125      651360 :     }
     126     1555725 :     if( FD_UNLIKELY( parity_remaining>0UL ) ) {
     127             :       /* Produce another 16 parity shreds */
     128           0 :       FD_REEDSOL_GENERATE_IFFT( 16, 32, ALL_VARS );
     129           0 :       FD_REEDSOL_GENERATE_FFT(  16, 48, ALL_VARS );
     130           0 :       switch( parity_remaining ) {
     131           0 :         default:
     132           0 :         case 16UL: gf_stu( parity_shred[ 15UL+parity_produced ] + shred_pos, in15 ); FALLTHRU
     133           0 :         case 15UL: gf_stu( parity_shred[ 14UL+parity_produced ] + shred_pos, in14 ); FALLTHRU
     134           0 :         case 14UL: gf_stu( parity_shred[ 13UL+parity_produced ] + shred_pos, in13 ); FALLTHRU
     135           0 :         case 13UL: gf_stu( parity_shred[ 12UL+parity_produced ] + shred_pos, in12 ); FALLTHRU
     136           0 :         case 12UL: gf_stu( parity_shred[ 11UL+parity_produced ] + shred_pos, in11 ); FALLTHRU
     137           0 :         case 11UL: gf_stu( parity_shred[ 10UL+parity_produced ] + shred_pos, in10 ); FALLTHRU
     138           0 :         case 10UL: gf_stu( parity_shred[  9UL+parity_produced ] + shred_pos, in09 ); FALLTHRU
     139           0 :         case  9UL: gf_stu( parity_shred[  8UL+parity_produced ] + shred_pos, in08 ); FALLTHRU
     140           0 :         case  8UL: gf_stu( parity_shred[  7UL+parity_produced ] + shred_pos, in07 ); FALLTHRU
     141           0 :         case  7UL: gf_stu( parity_shred[  6UL+parity_produced ] + shred_pos, in06 ); FALLTHRU
     142           0 :         case  6UL: gf_stu( parity_shred[  5UL+parity_produced ] + shred_pos, in05 ); FALLTHRU
     143           0 :         case  5UL: gf_stu( parity_shred[  4UL+parity_produced ] + shred_pos, in04 ); FALLTHRU
     144           0 :         case  4UL: gf_stu( parity_shred[  3UL+parity_produced ] + shred_pos, in03 ); FALLTHRU
     145           0 :         case  3UL: gf_stu( parity_shred[  2UL+parity_produced ] + shred_pos, in02 ); FALLTHRU
     146           0 :         case  2UL: gf_stu( parity_shred[  1UL+parity_produced ] + shred_pos, in01 ); FALLTHRU
     147           0 :         case  1UL: gf_stu( parity_shred[  0UL+parity_produced ] + shred_pos, in00 );
     148           0 :       }
     149           0 :       parity_produced += fd_ulong_min( 16UL, parity_remaining );
     150           0 :       parity_remaining = parity_shred_cnt - parity_produced;
     151           0 :     }
     152     1555725 :     if( FD_UNLIKELY( parity_remaining>0UL ) ) {
     153             :       /* Produce another 16 parity shreds */
     154           0 :       FD_REEDSOL_GENERATE_IFFT( 16, 48, ALL_VARS );
     155           0 :       FD_REEDSOL_GENERATE_FFT(  16, 64, ALL_VARS );
     156           0 :       switch( parity_remaining ) {
     157           0 :         default:
     158           0 :         case 16UL: gf_stu( parity_shred[ 15UL+parity_produced ] + shred_pos, in15 ); FALLTHRU
     159           0 :         case 15UL: gf_stu( parity_shred[ 14UL+parity_produced ] + shred_pos, in14 ); FALLTHRU
     160           0 :         case 14UL: gf_stu( parity_shred[ 13UL+parity_produced ] + shred_pos, in13 ); FALLTHRU
     161           0 :         case 13UL: gf_stu( parity_shred[ 12UL+parity_produced ] + shred_pos, in12 ); FALLTHRU
     162           0 :         case 12UL: gf_stu( parity_shred[ 11UL+parity_produced ] + shred_pos, in11 ); FALLTHRU
     163           0 :         case 11UL: gf_stu( parity_shred[ 10UL+parity_produced ] + shred_pos, in10 ); FALLTHRU
     164           0 :         case 10UL: gf_stu( parity_shred[  9UL+parity_produced ] + shred_pos, in09 ); FALLTHRU
     165           0 :         case  9UL: gf_stu( parity_shred[  8UL+parity_produced ] + shred_pos, in08 ); FALLTHRU
     166           0 :         case  8UL: gf_stu( parity_shred[  7UL+parity_produced ] + shred_pos, in07 ); FALLTHRU
     167           0 :         case  7UL: gf_stu( parity_shred[  6UL+parity_produced ] + shred_pos, in06 ); FALLTHRU
     168           0 :         case  6UL: gf_stu( parity_shred[  5UL+parity_produced ] + shred_pos, in05 ); FALLTHRU
     169           0 :         case  5UL: gf_stu( parity_shred[  4UL+parity_produced ] + shred_pos, in04 ); FALLTHRU
     170           0 :         case  4UL: gf_stu( parity_shred[  3UL+parity_produced ] + shred_pos, in03 ); FALLTHRU
     171           0 :         case  3UL: gf_stu( parity_shred[  2UL+parity_produced ] + shred_pos, in02 ); FALLTHRU
     172           0 :         case  2UL: gf_stu( parity_shred[  1UL+parity_produced ] + shred_pos, in01 ); FALLTHRU
     173           0 :         case  1UL: gf_stu( parity_shred[  0UL+parity_produced ] + shred_pos, in00 );
     174           0 :       }
     175           0 :       parity_produced += fd_ulong_min( 16UL, parity_remaining );
     176           0 :       parity_remaining = parity_shred_cnt - parity_produced;
     177           0 :     }
     178     1555725 :     if( FD_UNLIKELY( parity_remaining>0UL ) ) {
     179             :       /* Produce another 16 parity shreds */
     180           0 :       FD_REEDSOL_GENERATE_IFFT( 16, 64, ALL_VARS );
     181           0 :       FD_REEDSOL_GENERATE_FFT(  16, 80, ALL_VARS );
     182           0 :       switch( parity_remaining ) {
     183           0 :         default:
     184           0 :         case  4UL: gf_stu( parity_shred[  3UL+parity_produced ] + shred_pos, in03 ); FALLTHRU
     185           0 :         case  3UL: gf_stu( parity_shred[  2UL+parity_produced ] + shred_pos, in02 ); FALLTHRU
     186           0 :         case  2UL: gf_stu( parity_shred[  1UL+parity_produced ] + shred_pos, in01 ); FALLTHRU
     187           0 :         case  1UL: gf_stu( parity_shred[  0UL+parity_produced ] + shred_pos, in00 );
     188           0 :       }
     189           0 :       parity_produced += fd_ulong_min( 4UL, parity_remaining );
     190           0 :       parity_remaining = parity_shred_cnt - parity_produced;
     191           0 :     }
     192     1555725 :     #undef ALL_VARS
     193             :     /* In order to handle shred sizes that are not divisible by 32, we clamp
     194             :        shred_pos to shred_sz-32 when shred_sz-32<shred_pos<shred_sz
     195             :        (after the increment). */
     196     1555725 :     shred_pos += GF_WIDTH;
     197     1555725 :     shred_pos = fd_ulong_if( ((shred_sz-GF_WIDTH)<shred_pos) & (shred_pos<shred_sz), shred_sz-GF_WIDTH, shred_pos );
     198     1555725 :   }
     199       47760 : }

Generated by: LCOV version 1.14