M4RI
1.0.1
|
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_DOXYGEN 00030 00031 static inline word calculate_hash(word const* rowptr, wi_t wide) { 00032 unsigned long long hash = 0; 00033 for (word const* ptr = rowptr; ptr < rowptr + wide; ++ptr) 00034 hash ^= *ptr; 00035 return hash; 00036 } 00037 00038 static inline word rotate_word(word w, int shift) { 00039 return (w << shift) | (w >> (m4ri_radix - w)); 00040 } 00041 00042 #if __M4RI_DEBUG_DUMP 00043 00044 struct mzd_t; 00045 struct mzp_t; 00046 00047 extern void m4ri_dd_int(char const* function, char const* file, int line, int i); 00048 extern void m4ri_dd_rci(char const* function, char const* file, int line, rci_t rci); 00049 extern void m4ri_dd_rci_array(char const* function, char const* file, int line, rci_t *rciptr, int len); 00050 extern void m4ri_dd_rawrow(char const* function, char const* file, int line, word const* rowptr, wi_t wide); 00051 extern void m4ri_dd_row(char const* function, char const* file, int line, struct mzd_t const* M, rci_t row); 00052 extern void m4ri_dd_mzd(char const* function, char const* file, int line, struct mzd_t const* M); 00053 extern void m4ri_dd_mzp(char const* function, char const* file, int line, struct mzp_t const* P); 00054 00055 #define __M4RI_DD_INT(i) m4ri_dd_int(__FUNCTION__, __FILE__, __LINE__, i) 00056 #define __M4RI_DD_RCI(rci) m4ri_dd_rci(__FUNCTION__, __FILE__, __LINE__, rci) 00057 #define __M4RI_DD_RCI_ARRAY(rciptr, len) m4ri_dd_rci_array(__FUNCTION__, __FILE__, __LINE__, rciptr, len) 00058 #define __M4RI_DD_RAWROW(rowptr, wide) m4ri_dd_rawrow(__FUNCTION__, __FILE__, __LINE__, rowptr, wide) 00059 #define __M4RI_DD_ROW(M, row) m4ri_dd_row(__FUNCTION__, __FILE__, __LINE__, M, row) 00060 #define __M4RI_DD_MZD(M) m4ri_dd_mzd(__FUNCTION__, __FILE__, __LINE__, M) 00061 #define __M4RI_DD_MZP(P) m4ri_dd_mzp(__FUNCTION__, __FILE__, __LINE__, P) 00062 00063 #else // __M4RI_DEBUG_DUMP 00064 00065 #define __M4RI_DD_INT(i) 00066 #define __M4RI_DD_RCI(rci) 00067 #define __M4RI_DD_RCI_ARRAY(rciptr, len) 00068 #define __M4RI_DD_RAWROW(rowptr, wide) 00069 #define __M4RI_DD_ROW(M, row) 00070 #define __M4RI_DD_MZD(M) 00071 #define __M4RI_DD_MZP(P) 00072 00073 #endif // __M4RI_DEBUG_DUMP 00074 00075 #endif // M4RI_DOXYGEN