M4RI
1.0.1
|
00001 00009 #ifndef M4RI_MMC_H 00010 #define M4RI_MMC_H 00011 00012 /******************************************************************* 00013 * 00014 * M4RI: Linear Algebra over GF(2) 00015 * 00016 * Copyright (C) 2007, 2008 Gregory Bard <bard@fordham.edu> 00017 * Copyright (C) 2008 Martin Albrecht <M.R.Albrecht@rhul.ac.uk> 00018 * 00019 * Distributed under the terms of the GNU General Public License (GPL) 00020 * version 2 or higher. 00021 * 00022 * This code is distributed in the hope that it will be useful, 00023 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00024 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00025 * General Public License for more details. 00026 * 00027 * The full text of the GPL is available at: 00028 * 00029 * http://www.gnu.org/licenses/ 00030 * 00031 ********************************************************************/ 00032 00033 #include "misc.h" 00034 00035 void *m4ri_mmc_malloc(size_t size); 00036 void m4ri_mmc_free(void *condemned, size_t size); 00037 void m4ri_mmc_cleanup(void); 00038 00042 #define __M4RI_ENABLE_MMC 00043 00047 #define __M4RI_MMC_NBLOCKS 16 00048 00052 #define __M4RI_MMC_THRESHOLD __M4RI_CPU_L2_CACHE 00053 00057 typedef struct _mm_block { 00061 size_t size; 00062 00066 void *data; 00067 00068 } mmb_t; 00069 00078 static inline void *m4ri_mmc_calloc(size_t count, size_t size) { 00079 size_t total_size = count * size; 00080 void *ret = m4ri_mmc_malloc(total_size); 00081 memset((char*)ret, 0, total_size); 00082 return ret; 00083 } 00084 00085 #endif // M4RI_MMC_H