M4RI  1.0.1
debug_dump.h
Go to the documentation of this file.
00001 
00010 /******************************************************************************
00011 *
00012 *                 M4RI: Linear Algebra over GF(2)
00013 *
00014 *    Copyright (C) 2011 Carlo Wood <carlo@alinoe.com>
00015 *
00016 *  Distributed under the terms of the GNU General Public License (GPL)
00017 *  version 2 or higher.
00018 *
00019 *    This code is distributed in the hope that it will be useful,
00020 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00021 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00022 *    General Public License for more details.
00023 *
00024 *  The full text of the GPL is available at:
00025 *
00026 *                  http://www.gnu.org/licenses/
00027 ******************************************************************************/
00028 
00029 #ifndef M4RI_DEBUG_DUMP
00030 #define M4RI_DEBUG_DUMP
00031 
00032 static inline word calculate_hash(word const* rowptr, wi_t wide) {
00033   unsigned long long hash = 0;
00034   for (word const* ptr = rowptr; ptr < rowptr + wide; ++ptr)
00035     hash ^= *ptr;
00036   return hash;
00037 }
00038 
00039 static inline word rotate_word(word w, int shift) {
00040   return (w << shift) | (w >> (m4ri_radix - w));
00041 }
00042 
00043 #if __M4RI_DEBUG_DUMP
00044 
00045 struct mzd_t;
00046 struct mzp_t;
00047 
00048 extern void m4ri_dd_int(char const* function, char const* file, int line, int i);
00049 extern void m4ri_dd_rci(char const* function, char const* file, int line, rci_t rci);
00050 extern void m4ri_dd_rci_array(char const* function, char const* file, int line, rci_t *rciptr, int len);
00051 extern void m4ri_dd_rawrow(char const* function, char const* file, int line, word const* rowptr, wi_t wide);
00052 extern void m4ri_dd_row(char const* function, char const* file, int line, struct mzd_t const* M, rci_t row);
00053 extern void m4ri_dd_mzd(char const* function, char const* file, int line, struct mzd_t const* M);
00054 extern void m4ri_dd_mzp(char const* function, char const* file, int line, struct mzp_t const* P);
00055 
00056 #define __M4RI_DD_INT(i) m4ri_dd_int(__FUNCTION__, __FILE__, __LINE__, i)
00057 #define __M4RI_DD_RCI(rci) m4ri_dd_rci(__FUNCTION__, __FILE__, __LINE__, rci)
00058 #define __M4RI_DD_RCI_ARRAY(rciptr, len) m4ri_dd_rci_array(__FUNCTION__, __FILE__, __LINE__, rciptr, len)
00059 #define __M4RI_DD_RAWROW(rowptr, wide) m4ri_dd_rawrow(__FUNCTION__, __FILE__, __LINE__, rowptr, wide)
00060 #define __M4RI_DD_ROW(M, row) m4ri_dd_row(__FUNCTION__, __FILE__, __LINE__, M, row)
00061 #define __M4RI_DD_MZD(M) m4ri_dd_mzd(__FUNCTION__, __FILE__, __LINE__, M)
00062 #define __M4RI_DD_MZP(P) m4ri_dd_mzp(__FUNCTION__, __FILE__, __LINE__, P)
00063 
00064 #else // __M4RI_DEBUG_DUMP
00065 
00066 #define __M4RI_DD_INT(i)
00067 #define __M4RI_DD_RCI(rci)
00068 #define __M4RI_DD_RCI_ARRAY(rciptr, len)
00069 #define __M4RI_DD_RAWROW(rowptr, wide)
00070 #define __M4RI_DD_ROW(M, row)
00071 #define __M4RI_DD_MZD(M)
00072 #define __M4RI_DD_MZP(P)
00073 
00074 #endif // __M4RI_DEBUG_DUMP
00075 
00076 #endif // M4RI_DEBUG_DUMP