LCOV - code coverage report
Current view: top level - ballet/reedsol - fd_reedsol_encode_32.c (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 117 170 68.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_32( ulong                 shred_sz,
       6             :                               uchar const * const * data_shred,
       7             :                               ulong                 data_shred_cnt,
       8             :                               uchar       * const * parity_shred,
       9      814052 :                               ulong                 parity_shred_cnt ) {
      10    26863716 :   for( ulong shred_pos=0UL; shred_pos<shred_sz; /* advanced manually at end of loop */ ) {
      11    26049664 :     gf_t in00 = gf_ldu( data_shred[  0 ] + shred_pos );  gf_t in01 = gf_ldu( data_shred[  1 ] + shred_pos );
      12    26049664 :     gf_t in02 = gf_ldu( data_shred[  2 ] + shred_pos );  gf_t in03 = gf_ldu( data_shred[  3 ] + shred_pos );
      13    26049664 :     gf_t in04 = gf_ldu( data_shred[  4 ] + shred_pos );  gf_t in05 = gf_ldu( data_shred[  5 ] + shred_pos );
      14    26049664 :     gf_t in06 = gf_ldu( data_shred[  6 ] + shred_pos );  gf_t in07 = gf_ldu( data_shred[  7 ] + shred_pos );
      15    26049664 :     gf_t in08 = gf_ldu( data_shred[  8 ] + shred_pos );  gf_t in09 = gf_ldu( data_shred[  9 ] + shred_pos );
      16    26049664 :     gf_t in10 = gf_ldu( data_shred[ 10 ] + shred_pos );  gf_t in11 = gf_ldu( data_shred[ 11 ] + shred_pos );
      17    26049664 :     gf_t in12 = gf_ldu( data_shred[ 12 ] + shred_pos );  gf_t in13 = gf_ldu( data_shred[ 13 ] + shred_pos );
      18    26049664 :     gf_t in14 = gf_ldu( data_shred[ 14 ] + shred_pos );  gf_t in15 = gf_ldu( data_shred[ 15 ] + shred_pos );
      19    26049664 :     gf_t in16 = gf_zero();  gf_t in17 = gf_zero();  gf_t in18 = gf_zero();  gf_t in19 = gf_zero();
      20    26049664 :     gf_t in20 = gf_zero();  gf_t in21 = gf_zero();  gf_t in22 = gf_zero();  gf_t in23 = gf_zero();
      21    26049664 :     gf_t in24 = gf_zero();  gf_t in25 = gf_zero();  gf_t in26 = gf_zero();  gf_t in27 = gf_zero();
      22    26049664 :     gf_t in28 = gf_zero();  gf_t in29 = gf_zero();  gf_t in30 = gf_zero();  gf_t in31 = gf_zero();
      23    26049664 :     switch( data_shred_cnt ) {
      24    24616576 :       case 32UL: in31 = gf_ldu( data_shred[ 31 ] + shred_pos ); FALLTHRU
      25    24712192 :       case 31UL: in30 = gf_ldu( data_shred[ 30 ] + shred_pos ); FALLTHRU
      26    24807712 :       case 30UL: in29 = gf_ldu( data_shred[ 29 ] + shred_pos ); FALLTHRU
      27    24903232 :       case 29UL: in28 = gf_ldu( data_shred[ 28 ] + shred_pos ); FALLTHRU
      28    24998752 :       case 28UL: in27 = gf_ldu( data_shred[ 27 ] + shred_pos ); FALLTHRU
      29    25094272 :       case 27UL: in26 = gf_ldu( data_shred[ 26 ] + shred_pos ); FALLTHRU
      30    25189792 :       case 26UL: in25 = gf_ldu( data_shred[ 25 ] + shred_pos ); FALLTHRU
      31    25285408 :       case 25UL: in24 = gf_ldu( data_shred[ 24 ] + shred_pos ); FALLTHRU
      32    25380928 :       case 24UL: in23 = gf_ldu( data_shred[ 23 ] + shred_pos ); FALLTHRU
      33    25476448 :       case 23UL: in22 = gf_ldu( data_shred[ 22 ] + shred_pos ); FALLTHRU
      34    25571968 :       case 22UL: in21 = gf_ldu( data_shred[ 21 ] + shred_pos ); FALLTHRU
      35    25667488 :       case 21UL: in20 = gf_ldu( data_shred[ 20 ] + shred_pos ); FALLTHRU
      36    25763008 :       case 20UL: in19 = gf_ldu( data_shred[ 19 ] + shred_pos ); FALLTHRU
      37    25858528 :       case 19UL: in18 = gf_ldu( data_shred[ 18 ] + shred_pos ); FALLTHRU
      38    25954144 :       case 18UL: in17 = gf_ldu( data_shred[ 17 ] + shred_pos ); FALLTHRU
      39    26049664 :       case 17UL: in16 = gf_ldu( data_shred[ 16 ] + shred_pos );
      40    26049664 :     }
      41    26049664 :     #define ALL_VARS in00, in01, in02, in03, in04, in05, in06, in07, in08, in09, in10, in11, in12, in13, in14, in15, in16, in17, in18, in19, in20, in21, in22, in23, in24, in25, in26, in27, in28, in29, in30, in31
      42    26049664 :     switch( data_shred_cnt ) {
      43    24616576 :       case 32UL: FD_REEDSOL_GENERATE_IFFT( 32,  0, ALL_VARS ); break;
      44       95616 :       case 31UL: FD_REEDSOL_GENERATE_PPT(  32, 31, ALL_VARS ); break;
      45       95520 :       case 30UL: FD_REEDSOL_GENERATE_PPT(  32, 30, ALL_VARS ); break;
      46       95520 :       case 29UL: FD_REEDSOL_GENERATE_PPT(  32, 29, ALL_VARS ); break;
      47       95520 :       case 28UL: FD_REEDSOL_GENERATE_PPT(  32, 28, ALL_VARS ); break;
      48       95520 :       case 27UL: FD_REEDSOL_GENERATE_PPT(  32, 27, ALL_VARS ); break;
      49       95520 :       case 26UL: FD_REEDSOL_GENERATE_PPT(  32, 26, ALL_VARS ); break;
      50       95616 :       case 25UL: FD_REEDSOL_GENERATE_PPT(  32, 25, ALL_VARS ); break;
      51       95520 :       case 24UL: FD_REEDSOL_GENERATE_PPT(  32, 24, ALL_VARS ); break;
      52       95520 :       case 23UL: FD_REEDSOL_GENERATE_PPT(  32, 23, ALL_VARS ); break;
      53       95520 :       case 22UL: FD_REEDSOL_GENERATE_PPT(  32, 22, ALL_VARS ); break;
      54       95520 :       case 21UL: FD_REEDSOL_GENERATE_PPT(  32, 21, ALL_VARS ); break;
      55       95520 :       case 20UL: FD_REEDSOL_GENERATE_PPT(  32, 20, ALL_VARS ); break;
      56       95520 :       case 19UL: FD_REEDSOL_GENERATE_PPT(  32, 19, ALL_VARS ); break;
      57       95616 :       case 18UL: FD_REEDSOL_GENERATE_PPT(  32, 18, ALL_VARS ); break;
      58       95520 :       case 17UL: FD_REEDSOL_GENERATE_PPT(  32, 17, ALL_VARS ); break;
      59    26049664 :     }
      60             :     /* That generated the first 32-data_shred_cnt parity shreds in the
      61             :        last 32-data_shred_cnt variables. We might only need
      62             :        parity_shred_cnt of them though. */
      63    26049664 :     ulong total_shreds = data_shred_cnt+parity_shred_cnt;
      64    26049664 :     switch( data_shred_cnt ) {
      65       95520 :       case 17UL: if( total_shreds <= 17UL ) break; gf_stu( parity_shred[ 17UL-data_shred_cnt ] + shred_pos, in17 ); in17 = gf_zero(); FALLTHRU
      66      191136 :       case 18UL: if( total_shreds <= 18UL ) break; gf_stu( parity_shred[ 18UL-data_shred_cnt ] + shred_pos, in18 ); in18 = gf_zero(); FALLTHRU
      67      286656 :       case 19UL: if( total_shreds <= 19UL ) break; gf_stu( parity_shred[ 19UL-data_shred_cnt ] + shred_pos, in19 ); in19 = gf_zero(); FALLTHRU
      68      382176 :       case 20UL: if( total_shreds <= 20UL ) break; gf_stu( parity_shred[ 20UL-data_shred_cnt ] + shred_pos, in20 ); in20 = gf_zero(); FALLTHRU
      69      477696 :       case 21UL: if( total_shreds <= 21UL ) break; gf_stu( parity_shred[ 21UL-data_shred_cnt ] + shred_pos, in21 ); in21 = gf_zero(); FALLTHRU
      70      573216 :       case 22UL: if( total_shreds <= 22UL ) break; gf_stu( parity_shred[ 22UL-data_shred_cnt ] + shred_pos, in22 ); in22 = gf_zero(); FALLTHRU
      71      668736 :       case 23UL: if( total_shreds <= 23UL ) break; gf_stu( parity_shred[ 23UL-data_shred_cnt ] + shred_pos, in23 ); in23 = gf_zero(); FALLTHRU
      72      764256 :       case 24UL: if( total_shreds <= 24UL ) break; gf_stu( parity_shred[ 24UL-data_shred_cnt ] + shred_pos, in24 ); in24 = gf_zero(); FALLTHRU
      73      859872 :       case 25UL: if( total_shreds <= 25UL ) break; gf_stu( parity_shred[ 25UL-data_shred_cnt ] + shred_pos, in25 ); in25 = gf_zero(); FALLTHRU
      74      955392 :       case 26UL: if( total_shreds <= 26UL ) break; gf_stu( parity_shred[ 26UL-data_shred_cnt ] + shred_pos, in26 ); in26 = gf_zero(); FALLTHRU
      75     1050912 :       case 27UL: if( total_shreds <= 27UL ) break; gf_stu( parity_shred[ 27UL-data_shred_cnt ] + shred_pos, in27 ); in27 = gf_zero(); FALLTHRU
      76     1146432 :       case 28UL: if( total_shreds <= 28UL ) break; gf_stu( parity_shred[ 28UL-data_shred_cnt ] + shred_pos, in28 ); in28 = gf_zero(); FALLTHRU
      77     1241952 :       case 29UL: if( total_shreds <= 29UL ) break; gf_stu( parity_shred[ 29UL-data_shred_cnt ] + shred_pos, in29 ); in29 = gf_zero(); FALLTHRU
      78     1337472 :       case 30UL: if( total_shreds <= 30UL ) break; gf_stu( parity_shred[ 30UL-data_shred_cnt ] + shred_pos, in30 ); in30 = gf_zero(); FALLTHRU
      79     1433088 :       case 31UL: if( total_shreds <= 31UL ) break; gf_stu( parity_shred[ 31UL-data_shred_cnt ] + shred_pos, in31 ); in31 = gf_zero();
      80    26049664 :     }
      81    26049664 :     ulong parity_produced  = fd_ulong_min( 32UL - data_shred_cnt, parity_shred_cnt );
      82    26049664 :     ulong parity_remaining = parity_shred_cnt - parity_produced;
      83    26049664 :     if( FD_UNLIKELY( parity_remaining>0UL ) ) {
      84             :       /* Produce another 32 parity shreds */
      85    26049664 :       FD_REEDSOL_GENERATE_FFT(  32, 32, ALL_VARS );
      86    26049664 :       switch( parity_remaining ) {
      87           0 :         default:
      88    24616576 :         case 32UL: gf_stu( parity_shred[ 31UL+parity_produced ] + shred_pos, in31 ); FALLTHRU
      89    24712192 :         case 31UL: gf_stu( parity_shred[ 30UL+parity_produced ] + shred_pos, in30 ); FALLTHRU
      90    24807712 :         case 30UL: gf_stu( parity_shred[ 29UL+parity_produced ] + shred_pos, in29 ); FALLTHRU
      91    24807712 :         case 29UL: gf_stu( parity_shred[ 28UL+parity_produced ] + shred_pos, in28 ); FALLTHRU
      92    24903232 :         case 28UL: gf_stu( parity_shred[ 27UL+parity_produced ] + shred_pos, in27 ); FALLTHRU
      93    24998752 :         case 27UL: gf_stu( parity_shred[ 26UL+parity_produced ] + shred_pos, in26 ); FALLTHRU
      94    25094272 :         case 26UL: gf_stu( parity_shred[ 25UL+parity_produced ] + shred_pos, in25 ); FALLTHRU
      95    25094272 :         case 25UL: gf_stu( parity_shred[ 24UL+parity_produced ] + shred_pos, in24 ); FALLTHRU
      96    25189792 :         case 24UL: gf_stu( parity_shred[ 23UL+parity_produced ] + shred_pos, in23 ); FALLTHRU
      97    25285408 :         case 23UL: gf_stu( parity_shred[ 22UL+parity_produced ] + shred_pos, in22 ); FALLTHRU
      98    25285408 :         case 22UL: gf_stu( parity_shred[ 21UL+parity_produced ] + shred_pos, in21 ); FALLTHRU
      99    25380928 :         case 21UL: gf_stu( parity_shred[ 20UL+parity_produced ] + shred_pos, in20 ); FALLTHRU
     100    25476448 :         case 20UL: gf_stu( parity_shred[ 19UL+parity_produced ] + shred_pos, in19 ); FALLTHRU
     101    25571968 :         case 19UL: gf_stu( parity_shred[ 18UL+parity_produced ] + shred_pos, in18 ); FALLTHRU
     102    25571968 :         case 18UL: gf_stu( parity_shred[ 17UL+parity_produced ] + shred_pos, in17 ); FALLTHRU
     103    25667488 :         case 17UL: gf_stu( parity_shred[ 16UL+parity_produced ] + shred_pos, in16 ); FALLTHRU
     104    25763008 :         case 16UL: gf_stu( parity_shred[ 15UL+parity_produced ] + shred_pos, in15 ); FALLTHRU
     105    25763008 :         case 15UL: gf_stu( parity_shred[ 14UL+parity_produced ] + shred_pos, in14 ); FALLTHRU
     106    25858528 :         case 14UL: gf_stu( parity_shred[ 13UL+parity_produced ] + shred_pos, in13 ); FALLTHRU
     107    25954144 :         case 13UL: gf_stu( parity_shred[ 12UL+parity_produced ] + shred_pos, in12 ); FALLTHRU
     108    25954144 :         case 12UL: gf_stu( parity_shred[ 11UL+parity_produced ] + shred_pos, in11 ); FALLTHRU
     109    26049664 :         case 11UL: gf_stu( parity_shred[ 10UL+parity_produced ] + shred_pos, in10 ); FALLTHRU
     110    26049664 :         case 10UL: gf_stu( parity_shred[  9UL+parity_produced ] + shred_pos, in09 ); FALLTHRU
     111    26049664 :         case  9UL: gf_stu( parity_shred[  8UL+parity_produced ] + shred_pos, in08 ); FALLTHRU
     112    26049664 :         case  8UL: gf_stu( parity_shred[  7UL+parity_produced ] + shred_pos, in07 ); FALLTHRU
     113    26049664 :         case  7UL: gf_stu( parity_shred[  6UL+parity_produced ] + shred_pos, in06 ); FALLTHRU
     114    26049664 :         case  6UL: gf_stu( parity_shred[  5UL+parity_produced ] + shred_pos, in05 ); FALLTHRU
     115    26049664 :         case  5UL: gf_stu( parity_shred[  4UL+parity_produced ] + shred_pos, in04 ); FALLTHRU
     116    26049664 :         case  4UL: gf_stu( parity_shred[  3UL+parity_produced ] + shred_pos, in03 ); FALLTHRU
     117    26049664 :         case  3UL: gf_stu( parity_shred[  2UL+parity_produced ] + shred_pos, in02 ); FALLTHRU
     118    26049664 :         case  2UL: gf_stu( parity_shred[  1UL+parity_produced ] + shred_pos, in01 ); FALLTHRU
     119    26049664 :         case  1UL: gf_stu( parity_shred[  0UL+parity_produced ] + shred_pos, in00 );
     120    26049664 :       }
     121    26049664 :       parity_produced += fd_ulong_min( 32UL, parity_remaining );
     122    26049664 :       parity_remaining = parity_shred_cnt - parity_produced;
     123    26049664 :     }
     124    26049664 :     if( FD_UNLIKELY( parity_remaining>0UL ) ) {
     125             :       /* Produce another 32 parity shreds */
     126           0 :       FD_REEDSOL_GENERATE_IFFT( 32, 32, ALL_VARS );
     127           0 :       FD_REEDSOL_GENERATE_FFT(  32, 64, ALL_VARS );
     128           0 :       switch( parity_remaining ) {
     129           0 :         default:
     130           0 :         case 32UL: gf_stu( parity_shred[ 31UL+parity_produced ] + shred_pos, in31 ); FALLTHRU
     131           0 :         case 31UL: gf_stu( parity_shred[ 30UL+parity_produced ] + shred_pos, in30 ); FALLTHRU
     132           0 :         case 30UL: gf_stu( parity_shred[ 29UL+parity_produced ] + shred_pos, in29 ); FALLTHRU
     133           0 :         case 29UL: gf_stu( parity_shred[ 28UL+parity_produced ] + shred_pos, in28 ); FALLTHRU
     134           0 :         case 28UL: gf_stu( parity_shred[ 27UL+parity_produced ] + shred_pos, in27 ); FALLTHRU
     135           0 :         case 27UL: gf_stu( parity_shred[ 26UL+parity_produced ] + shred_pos, in26 ); FALLTHRU
     136           0 :         case 26UL: gf_stu( parity_shred[ 25UL+parity_produced ] + shred_pos, in25 ); FALLTHRU
     137           0 :         case 25UL: gf_stu( parity_shred[ 24UL+parity_produced ] + shred_pos, in24 ); FALLTHRU
     138           0 :         case 24UL: gf_stu( parity_shred[ 23UL+parity_produced ] + shred_pos, in23 ); FALLTHRU
     139           0 :         case 23UL: gf_stu( parity_shred[ 22UL+parity_produced ] + shred_pos, in22 ); FALLTHRU
     140           0 :         case 22UL: gf_stu( parity_shred[ 21UL+parity_produced ] + shred_pos, in21 ); FALLTHRU
     141           0 :         case 21UL: gf_stu( parity_shred[ 20UL+parity_produced ] + shred_pos, in20 ); FALLTHRU
     142           0 :         case 20UL: gf_stu( parity_shred[ 19UL+parity_produced ] + shred_pos, in19 ); FALLTHRU
     143           0 :         case 19UL: gf_stu( parity_shred[ 18UL+parity_produced ] + shred_pos, in18 ); FALLTHRU
     144           0 :         case 18UL: gf_stu( parity_shred[ 17UL+parity_produced ] + shred_pos, in17 ); FALLTHRU
     145           0 :         case 17UL: gf_stu( parity_shred[ 16UL+parity_produced ] + shred_pos, in16 ); FALLTHRU
     146           0 :         case 16UL: gf_stu( parity_shred[ 15UL+parity_produced ] + shred_pos, in15 ); FALLTHRU
     147           0 :         case 15UL: gf_stu( parity_shred[ 14UL+parity_produced ] + shred_pos, in14 ); FALLTHRU
     148           0 :         case 14UL: gf_stu( parity_shred[ 13UL+parity_produced ] + shred_pos, in13 ); FALLTHRU
     149           0 :         case 13UL: gf_stu( parity_shred[ 12UL+parity_produced ] + shred_pos, in12 ); FALLTHRU
     150           0 :         case 12UL: gf_stu( parity_shred[ 11UL+parity_produced ] + shred_pos, in11 ); FALLTHRU
     151           0 :         case 11UL: gf_stu( parity_shred[ 10UL+parity_produced ] + shred_pos, in10 ); FALLTHRU
     152           0 :         case 10UL: gf_stu( parity_shred[  9UL+parity_produced ] + shred_pos, in09 ); FALLTHRU
     153           0 :         case  9UL: gf_stu( parity_shred[  8UL+parity_produced ] + shred_pos, in08 ); FALLTHRU
     154           0 :         case  8UL: gf_stu( parity_shred[  7UL+parity_produced ] + shred_pos, in07 ); FALLTHRU
     155           0 :         case  7UL: gf_stu( parity_shred[  6UL+parity_produced ] + shred_pos, in06 ); FALLTHRU
     156           0 :         case  6UL: gf_stu( parity_shred[  5UL+parity_produced ] + shred_pos, in05 ); FALLTHRU
     157           0 :         case  5UL: gf_stu( parity_shred[  4UL+parity_produced ] + shred_pos, in04 ); FALLTHRU
     158           0 :         case  4UL: gf_stu( parity_shred[  3UL+parity_produced ] + shred_pos, in03 ); FALLTHRU
     159           0 :         case  3UL: gf_stu( parity_shred[  2UL+parity_produced ] + shred_pos, in02 ); FALLTHRU
     160           0 :         case  2UL: gf_stu( parity_shred[  1UL+parity_produced ] + shred_pos, in01 ); FALLTHRU
     161           0 :         case  1UL: gf_stu( parity_shred[  0UL+parity_produced ] + shred_pos, in00 );
     162           0 :       }
     163           0 :       parity_produced += fd_ulong_min( 32UL, parity_remaining );
     164           0 :       parity_remaining = parity_shred_cnt - parity_produced;
     165           0 :     }
     166    26049664 :     if( FD_UNLIKELY( parity_remaining>0UL ) ) {
     167             :       /* Produce another 32 parity shreds */
     168           0 :       FD_REEDSOL_GENERATE_IFFT( 32, 64, ALL_VARS );
     169           0 :       FD_REEDSOL_GENERATE_FFT(  32, 96, ALL_VARS );
     170           0 :       switch( parity_remaining ) {
     171           0 :         default:
     172           0 :         case  4UL: gf_stu( parity_shred[  3UL+parity_produced ] + shred_pos, in03 ); FALLTHRU
     173           0 :         case  3UL: gf_stu( parity_shred[  2UL+parity_produced ] + shred_pos, in02 ); FALLTHRU
     174           0 :         case  2UL: gf_stu( parity_shred[  1UL+parity_produced ] + shred_pos, in01 ); FALLTHRU
     175           0 :         case  1UL: gf_stu( parity_shred[  0UL+parity_produced ] + shred_pos, in00 );
     176           0 :       }
     177           0 :       parity_produced += fd_ulong_min( 4UL, parity_remaining );
     178           0 :       parity_remaining = parity_shred_cnt - parity_produced;
     179           0 :     }
     180    26049664 :     #undef ALL_VARS
     181             :     /* In order to handle shred sizes that are not divisible by 32, we clamp
     182             :        shred_pos to shred_sz-32 when shred_sz-32<shred_pos<shred_sz
     183             :        (after the increment). */
     184    26049664 :     shred_pos += GF_WIDTH;
     185    26049664 :     shred_pos = fd_ulong_if( ((shred_sz-GF_WIDTH)<shred_pos) & (shred_pos<shred_sz), shred_sz-GF_WIDTH, shred_pos );
     186    26049664 :   }
     187      814052 : }

Generated by: LCOV version 1.14