Commits

CarloWood committed 2809e3f

More constness and some whitespace issues.

Comments (0)

Files changed (5)

src/brilliantrussian.c

   return k;
 }
 
-static inline void _mzd_copy_back_rows(mzd_t *A, mzd_t *U, rci_t r, rci_t c, int k) {
+static inline void _mzd_copy_back_rows(mzd_t *A, mzd_t const *U, rci_t r, rci_t c, int k) {
   wi_t const startblock = c / m4ri_radix;
   wi_t const width = A->width - startblock;
   for (int i = 0; i < k; ++i) {

src/permutation.c

 
 /* optimised column swap operations */
 
-static inline void mzd_write_col_to_rows_blockd(mzd_t *A, mzd_t *B, rci_t *permutation, word *write_mask, rci_t const start_row, rci_t const stop_row, rci_t length) {
+static inline void mzd_write_col_to_rows_blockd(mzd_t *A, mzd_t const *B, rci_t const *permutation, word const *write_mask, rci_t const start_row, rci_t const stop_row, rci_t length) {
   assert(A->offset == 0);
   for(rci_t i = 0; i < length; i += m4ri_radix) {
     /* optimisation for identity permutations */
     }
 
     for (rci_t r = start_row; r < stop_row; ++r) {
-      word *Brow = B->rows[r-start_row];
+      word const *Brow = B->rows[r-start_row];
       word *Arow = A->rows[r];
       register word value = 0;
 

src/permutation.h

 
 void mzp_free(mzp_t *P);
 
-
 /**
  * \brief Create a window/view into the permutation P.
  *
 
 void mzd_apply_p_right_trans(mzd_t *A, mzp_t const *P);
 
-
 /**
  * Apply the permutation P to A from the right starting at start_row.
  *
 
 void mzd_apply_p_right_trans(mzd_t *A, mzp_t const *P);
 
-
 /**
  * Apply the permutation P to A from the right, but only on the upper
  * the matrix A above the main diagonal.
 }
 
 /* create a table of all 2^k linear combinations */
-void mzd_make_table_pls(mzd_t *M, rci_t r, rci_t c, int k, mzd_t *T, rci_t *Le, rci_t *Lm) {
+void mzd_make_table_pls(mzd_t const *M, rci_t r, rci_t c, int k, mzd_t *T, rci_t *Le, rci_t *Lm) {
   assert(T->blocks[1].size == 0);
   wi_t const blockoffset= c / m4ri_radix;
   int const twokay= __M4RI_TWOPOW(k);
   }
 }
 
-void mzd_process_rows2_pls(mzd_t *M, rci_t startrow, rci_t stoprow, rci_t startcol, int k, mzd_t *T0, rci_t *E0, mzd_t *T1, rci_t *E1) {
+void mzd_process_rows2_pls(mzd_t *M, rci_t startrow, rci_t stoprow, rci_t startcol, int k,
+                           mzd_t const *T0, rci_t const *E0, mzd_t const *T1, rci_t const *E1) {
   int const ka = k / 2;
   int const kb = k - k / 2;
   wi_t const blocknuma = startcol / m4ri_radix;
 #endif
   for(rci_t r = startrow; r < stoprow; ++r) {
     rci_t const x0 = E0[ mzd_read_bits_int(M, r, startcol, ka) ];
-    word *t0 = T0->rows[x0] + blocknuma;
+    word const *t0 = T0->rows[x0] + blocknuma;
     word *m0 = M->rows[r+0] + blocknuma;
     m0[0] ^= t0[0];
     m0[1] ^= t0[1];
     rci_t const x1 = E1[ mzd_read_bits_int(M, r, startcol+ka, kb) ];
-    word *t1 = T1->rows[x1] + blocknumb;
+    word const *t1 = T1->rows[x1] + blocknumb;
     for(wi_t i = blockoffset; i < 2; ++i) {
       m0[i] ^= t1[i - blockoffset];
     }
   }
 }
 
-void mzd_process_rows3_pls(mzd_t *M, rci_t startrow, rci_t stoprow, rci_t startcol, int k, mzd_t *T0, rci_t *E0, mzd_t *T1, rci_t *E1, mzd_t *T2, rci_t *E2) {
+void mzd_process_rows3_pls(mzd_t *M, rci_t startrow, rci_t stoprow, rci_t startcol, int k,
+                           mzd_t const *T0, rci_t const *E0, mzd_t const *T1, rci_t const *E1,
+			   mzd_t const *T2, rci_t const *E2) {
   int const rem = k % 3;
   int const ka = k / 3 + ((rem >= 2) ? 1 : 0);
   int const kb = k / 3 + ((rem >= 1) ? 1 : 0);
 #endif
   for(rci_t r = startrow; r < stoprow; ++r) {
     rci_t const x0 = E0[ mzd_read_bits_int(M, r, startcol, ka) ];
-    word *t0 = T0->rows[x0] + blocknuma;
+    word const *t0 = T0->rows[x0] + blocknuma;
     word *m0 = M->rows[r] + blocknuma;
     m0[0] ^= t0[0];
     m0[1] ^= t0[1];
     t0 += 3;
 
     rci_t const x1 = E1[ mzd_read_bits_int(M, r, startcol+ka, kb) ];
-    word *t1 = T1->rows[x1] + blocknumb;
+    word const *t1 = T1->rows[x1] + blocknumb;
     for(wi_t i = blockoffsetb; i < 3; ++i) {
       m0[i] ^= t1[i-blockoffsetb];
     }
     t1 += 3 - blockoffsetb;
 
     rci_t const x2 = E2[ mzd_read_bits_int(M, r, startcol+ka+kb, kc) ];
-    word *t2 = T2->rows[x2] + blocknumc;
+    word const *t2 = T2->rows[x2] + blocknumc;
     for(wi_t i = blockoffsetc; i < 3; ++i) {
       m0[i] ^= t2[i-blockoffsetc];
     }
   }
 }
 
-void mzd_process_rows4_pls(mzd_t *M, rci_t startrow, rci_t stoprow, rci_t startcol, int k, mzd_t *T0, rci_t *E0, mzd_t *T1, rci_t *E1, mzd_t *T2, rci_t *E2, mzd_t *T3, rci_t *E3) {
+void mzd_process_rows4_pls(mzd_t *M, rci_t startrow, rci_t stoprow, rci_t startcol, int k,
+                           mzd_t const *T0, rci_t const *E0, mzd_t const *T1, rci_t const *E1,
+			   mzd_t const *T2, rci_t const *E2, mzd_t const *T3, rci_t const *E3) {
   int const rem = k % 4;
   int const ka = k / 4 + ((rem >= 3) ? 1 : 0);
   int const kb = k / 4 + ((rem >= 2) ? 1 : 0);
 }
 
 void _mzd_finish_pls_done_rest1(mzd_t *A,
-    rci_t const start_row, rci_t const stop_row, rci_t const start_col, wi_t const addblock, int k0, mzd_t *T0, rci_t const *M0) {
+    rci_t const start_row, rci_t const stop_row, rci_t const start_col, wi_t const addblock, int k0, mzd_t const *T0, rci_t const *M0) {
 
   wi_t const wide = A->width - addblock;
   if (wide <= 0)
 
 void _mzd_finish_pls_done_rest2(mzd_t *A,
     rci_t const start_row, rci_t const stop_row, rci_t const start_col, wi_t const addblock, 
-    int k0, mzd_t *T0, rci_t const *M0, int k1, mzd_t *T1, rci_t const *M1) {
+    int k0, mzd_t const *T0, rci_t const *M0, int k1, mzd_t const *T1, rci_t const *M1) {
 
   wi_t const wide = A->width - addblock;
   if (wide <= 0)
 
 void _mzd_finish_pls_done_rest3(mzd_t *A,
     rci_t const start_row, rci_t const stop_row, rci_t const start_col, wi_t const addblock, 
-    int k0, mzd_t *T0, rci_t const *M0, int k1, mzd_t *T1, rci_t const *M1, int k2, mzd_t *T2, rci_t const *M2) { 
+    int k0, mzd_t *T0, rci_t const *M0, int k1, mzd_t const *T1, rci_t const *M1, int k2, mzd_t const *T2, rci_t const *M2) { 
   wi_t const wide = A->width - addblock;
   if (wide <= 0)
     return;
 }
 
 /* extract U from A for table creation */
-mzd_t *_mzd_pls_to_u(mzd_t *U, mzd_t *A, rci_t r, rci_t c, int k) {
+mzd_t *_mzd_pls_to_u(mzd_t *U, mzd_t const *A, rci_t r, rci_t c, int k) {
   /* this function call is now rather cheap, but it could be avoided
      completetly if needed */
   assert(U->offset == 0);
 }
 
 rci_t _mzd_pluq_mmpf(mzd_t *A, mzp_t *P, mzp_t *Q, int const k) {
-  rci_t r  = _mzd_pls_mmpf(A, P, Q, k);
+  rci_t r = _mzd_pls_mmpf(A, P, Q, k);
   mzd_apply_p_right_trans_tri(A, Q);
   return r;
 }
   /**
    \verbatim  
      |\
-     | \  
+     | \
      |  \
      |L00\
      |____\
-     |    |\  
+     |    |\
      |    | \
      |    |  \
-     |L10 |L11\ 
+     |L10 |L11\
      |____|____\
       _________
      |B0  |B1  |