From 992d4b4b8d3f3a630a2cf00d593ee4ce4dfa7ce8 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Thu, 9 Jan 2025 22:12:06 +0100 Subject: New upstream version 2.7.0~rc8+repack --- lib/encode_msk40.f90 | 92 ++++++++++++++++++++++++++-------------------------- 1 file changed, 46 insertions(+), 46 deletions(-) (limited to 'lib/encode_msk40.f90') diff --git a/lib/encode_msk40.f90 b/lib/encode_msk40.f90 index 5f1dc429..9c53255b 100755 --- a/lib/encode_msk40.f90 +++ b/lib/encode_msk40.f90 @@ -1,46 +1,46 @@ -subroutine encode_msk40(message,codeword) -! Encode a 16-bit message and return a 32-bit codeword. -! The code is a (32,16) regular ldpc code with column weight 3. -! The code was generated using the PEG algorithm. -! After creating the codeword, the columns are re-ordered according to -! "colorder" to make the codeword compatible with the parity-check -! matrix stored in Radford Neal's "pchk" format. -! -integer*1 codeword(32) -integer*1 colorder(32) -integer g(16) -integer*1 gen40(16,16) -integer*1 itmp(32) -integer*1 message(16) -integer*1 pchecks(16) -logical first -data first/.true./ -data g/Z'4428',Z'5a6b',Z'1b04',Z'2c12',Z'60c4',Z'1071',Z'be6a',Z'36dd', & - Z'c580',Z'ad9a',Z'eca2',Z'7843',Z'332e',Z'a685',Z'5906',Z'1efe'/ -data colorder/4,1,2,3,0,8,6,10,13,28,20,23,17,15,27,25, & - 16,12,18,19,7,21,22,11,24,5,26,14,9,29,30,31/ -save first,gen40 - -if( first ) then ! fill the generator matrix - gen40=0 - do i=1,16 - do j=1,16 - if( btest(g(i),16-j) ) gen40(i,j)=1 - enddo - enddo - first=.false. -endif - -do i=1,16 - nsum=0 - do j=1,16 - nsum=nsum+message(j)*gen40(i,j) - enddo - pchecks(i)=mod(nsum,2) -enddo -itmp(1:16)=pchecks -itmp(17:32)=message(1:16) -codeword(colorder+1)=itmp(1:32) - -return -end subroutine encode_msk40 +subroutine encode_msk40(message,codeword) +! Encode a 16-bit message and return a 32-bit codeword. +! The code is a (32,16) regular ldpc code with column weight 3. +! The code was generated using the PEG algorithm. +! After creating the codeword, the columns are re-ordered according to +! "colorder" to make the codeword compatible with the parity-check +! matrix stored in Radford Neal's "pchk" format. +! +integer*1 codeword(32) +integer*1 colorder(32) +integer g(16) +integer*1 gen40(16,16) +integer*1 itmp(32) +integer*1 message(16) +integer*1 pchecks(16) +logical first +data first/.true./ +data g/Z'4428',Z'5a6b',Z'1b04',Z'2c12',Z'60c4',Z'1071',Z'be6a',Z'36dd', & + Z'c580',Z'ad9a',Z'eca2',Z'7843',Z'332e',Z'a685',Z'5906',Z'1efe'/ +data colorder/4,1,2,3,0,8,6,10,13,28,20,23,17,15,27,25, & + 16,12,18,19,7,21,22,11,24,5,26,14,9,29,30,31/ +save first,gen40 + +if( first ) then ! fill the generator matrix + gen40=0 + do i=1,16 + do j=1,16 + if( btest(g(i),16-j) ) gen40(i,j)=1 + enddo + enddo + first=.false. +endif + +do i=1,16 + nsum=0 + do j=1,16 + nsum=nsum+message(j)*gen40(i,j) + enddo + pchecks(i)=mod(nsum,2) +enddo +itmp(1:16)=pchecks +itmp(17:32)=message(1:16) +codeword(colorder+1)=itmp(1:32) + +return +end subroutine encode_msk40 -- cgit v1.2.3