M4RI
20200125
mmc.h
Go to the documentation of this file.
1
9
#ifndef M4RI_MMC_H
10
#define M4RI_MMC_H
11
12
/*******************************************************************
13
*
14
* M4RI: Linear Algebra over GF(2)
15
*
16
* Copyright (C) 2007, 2008 Gregory Bard <bard@fordham.edu>
17
* Copyright (C) 2008 Martin Albrecht <M.R.Albrecht@rhul.ac.uk>
18
*
19
* Distributed under the terms of the GNU General Public License (GPL)
20
* version 2 or higher.
21
*
22
* This code is distributed in the hope that it will be useful,
23
* but WITHOUT ANY WARRANTY; without even the implied warranty of
24
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25
* General Public License for more details.
26
*
27
* The full text of the GPL is available at:
28
*
29
* http://www.gnu.org/licenses/
30
*
31
********************************************************************/
32
33
#include <
m4ri/misc.h
>
34
35
void
*
m4ri_mmc_malloc
(
size_t
size);
36
void
m4ri_mmc_free
(
void
*condemned,
size_t
size);
37
void
m4ri_mmc_cleanup
(
void
);
38
42
#define __M4RI_MMC_NBLOCKS 16
43
47
#define __M4RI_MMC_THRESHOLD __M4RI_CPU_L3_CACHE
48
52
typedef
struct
_mm_block
{
56
size_t
size
;
57
61
void
*
data
;
62
63
}
mmb_t
;
64
73
static
inline
void
*
m4ri_mmc_calloc
(
size_t
count,
size_t
size) {
74
size_t
total_size = count * size;
75
void
*ret =
m4ri_mmc_malloc
(total_size);
76
memset((
char
*)ret, 0, total_size);
77
return
ret;
78
}
79
80
#endif // M4RI_MMC_H
_mm_block
Tuple of pointer to allocated memory block and it's size.
Definition:
mmc.h:52
m4ri_mmc_cleanup
void m4ri_mmc_cleanup(void)
Cleans up memory block cache.
Definition:
mmc.c:127
m4ri_mmc_free
void m4ri_mmc_free(void *condemned, size_t size)
Free the data pointed to by condemned of the given size.
Definition:
mmc.c:85
_mm_block::size
size_t size
Definition:
mmc.h:56
misc.h
Helper functions.
mmb_t
struct _mm_block mmb_t
Tuple of pointer to allocated memory block and it's size.
m4ri_mmc_malloc
void * m4ri_mmc_malloc(size_t size)
Allocate size bytes.
Definition:
mmc.c:44
_mm_block::data
void * data
Definition:
mmc.h:61
m4ri_mmc_calloc
static void * m4ri_mmc_calloc(size_t count, size_t size)
Allocate an array of count times size zeroed bytes.
Definition:
mmc.h:73
Generated on Tue Jul 28 2020 00:00:00 for M4RI by
1.8.18