M4RI  20140914
debug_dump.h
1 /*
2  * To enable dumping of output per function, configure the library with --enable-debug-dump.
3  */
4 
5 /******************************************************************************
6 *
7 * M4RI: Linear Algebra over GF(2)
8 *
9 * Copyright (C) 2011 Carlo Wood <carlo@alinoe.com>
10 *
11 * Distributed under the terms of the GNU General Public License (GPL)
12 * version 2 or higher.
13 *
14 * This code is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * The full text of the GPL is available at:
20 *
21 * http://www.gnu.org/licenses/
22 ******************************************************************************/
23 
24 #ifndef M4RI_DEBUG_DUMP
25 #define M4RI_DEBUG_DUMP
26 
27 static inline word calculate_hash(word const* rowptr, wi_t wide) {
28  word hash = 0;
29  for (word const* ptr = rowptr; ptr < rowptr + wide; ++ptr)
30  hash ^= *ptr;
31  return hash;
32 }
33 
34 static inline word rotate_word(word w, int shift) {
35  return (w << shift) | (w >> (m4ri_radix - w));
36 }
37 
38 #if __M4RI_DEBUG_DUMP
39 
40 struct mzd_t;
41 struct mzp_t;
42 
43 extern void m4ri_dd_int(char const* function, char const* file, int line, int i);
44 extern void m4ri_dd_rci(char const* function, char const* file, int line, rci_t rci);
45 extern void m4ri_dd_rci_array(char const* function, char const* file, int line, rci_t *rciptr, int len);
46 extern void m4ri_dd_rawrow(char const* function, char const* file, int line, word const* rowptr, wi_t wide);
47 extern void m4ri_dd_row(char const* function, char const* file, int line, struct mzd_t const* M, rci_t row);
48 extern void m4ri_dd_mzd(char const* function, char const* file, int line, struct mzd_t const* M);
49 extern void m4ri_dd_mzp(char const* function, char const* file, int line, struct mzp_t const* P);
50 
51 #define __M4RI_DD_INT(i) m4ri_dd_int(__FUNCTION__, __FILE__, __LINE__, i)
52 #define __M4RI_DD_RCI(rci) m4ri_dd_rci(__FUNCTION__, __FILE__, __LINE__, rci)
53 #define __M4RI_DD_RCI_ARRAY(rciptr, len) m4ri_dd_rci_array(__FUNCTION__, __FILE__, __LINE__, rciptr, len)
54 #define __M4RI_DD_RAWROW(rowptr, wide) m4ri_dd_rawrow(__FUNCTION__, __FILE__, __LINE__, rowptr, wide)
55 #define __M4RI_DD_ROW(M, row) m4ri_dd_row(__FUNCTION__, __FILE__, __LINE__, M, row)
56 #define __M4RI_DD_MZD(M) m4ri_dd_mzd(__FUNCTION__, __FILE__, __LINE__, M)
57 #define __M4RI_DD_MZP(P) m4ri_dd_mzp(__FUNCTION__, __FILE__, __LINE__, P)
58 
59 #else // __M4RI_DEBUG_DUMP
60 
61 #define __M4RI_DD_INT(i)
62 #define __M4RI_DD_RCI(rci)
63 #define __M4RI_DD_RCI_ARRAY(rciptr, len)
64 #define __M4RI_DD_RAWROW(rowptr, wide)
65 #define __M4RI_DD_ROW(M, row)
66 #define __M4RI_DD_MZD(M)
67 #define __M4RI_DD_MZP(P)
68 
69 #endif // __M4RI_DEBUG_DUMP
70 
71 #endif // M4RI_DEBUG_DUMP
static int const m4ri_radix
The number of bits in a word.
Definition: misc.h:141
Dense matrices over GF(2).
Definition: mzd.h:86
int rci_t
Type of row and column indexes.
Definition: misc.h:72
Permutations.
Definition: mzp.h:37
uint64_t word
A word is the typical packed data structure to represent packed bits.
Definition: misc.h:87
int wi_t
Type of word indexes.
Definition: misc.h:80