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
27static 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}
32 return hash;
33}
34
35static inline word rotate_word(word w, int shift) {
36 return (w << shift) | (w >> (m4ri_radix - w));
37}
38
39#if __M4RI_DEBUG_DUMP
40
41struct mzd_t;
42struct mzp_t;
43
44extern void m4ri_dd_int(char const* function, char const* file, int line, int i);
45extern void m4ri_dd_rci(char const* function, char const* file, int line, rci_t rci);
46extern void m4ri_dd_rci_array(char const* function, char const* file, int line, rci_t *rciptr, int len);
47extern void m4ri_dd_rawrow(char const* function, char const* file, int line, word const* rowptr, wi_t wide);
48extern void m4ri_dd_row(char const* function, char const* file, int line, struct mzd_t const* M, rci_t row);
49extern void m4ri_dd_mzd(char const* function, char const* file, int line, struct mzd_t const* M);
50extern void m4ri_dd_mzp(char const* function, char const* file, int line, struct mzp_t const* P);
51
52#define __M4RI_DD_INT(i) m4ri_dd_int(__FUNCTION__, __FILE__, __LINE__, i)
53#define __M4RI_DD_RCI(rci) m4ri_dd_rci(__FUNCTION__, __FILE__, __LINE__, rci)
54#define __M4RI_DD_RCI_ARRAY(rciptr, len) m4ri_dd_rci_array(__FUNCTION__, __FILE__, __LINE__, rciptr, len)
55#define __M4RI_DD_RAWROW(rowptr, wide) m4ri_dd_rawrow(__FUNCTION__, __FILE__, __LINE__, rowptr, wide)
56#define __M4RI_DD_ROW(M, row) m4ri_dd_row(__FUNCTION__, __FILE__, __LINE__, M, row)
57#define __M4RI_DD_MZD(M) m4ri_dd_mzd(__FUNCTION__, __FILE__, __LINE__, M)
58#define __M4RI_DD_MZP(P) m4ri_dd_mzp(__FUNCTION__, __FILE__, __LINE__, P)
59
60#else // __M4RI_DEBUG_DUMP
61
62#define __M4RI_DD_INT(i)
63#define __M4RI_DD_RCI(rci)
64#define __M4RI_DD_RCI_ARRAY(rciptr, len)
65#define __M4RI_DD_RAWROW(rowptr, wide)
66#define __M4RI_DD_ROW(M, row)
67#define __M4RI_DD_MZD(M)
68#define __M4RI_DD_MZP(P)
69
70#endif // __M4RI_DEBUG_DUMP
71
72#endif // M4RI_DEBUG_DUMP
int rci_t
Type of row and column indexes.
Definition: misc.h:72
uint64_t word
A word is the typical packed data structure to represent packed bits.
Definition: misc.h:87
static int const m4ri_radix
The number of bits in a word.
Definition: misc.h:141
int wi_t
Type of word indexes.
Definition: misc.h:80
Dense matrices over GF(2).
Definition: mzd.h:86
Permutations.
Definition: mzp.h:37