aboutsummaryrefslogtreecommitdiffstats
path: root/vmemalloc.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2018-11-24 01:48:25 +0100
committerMattias Andrée <maandree@kth.se>2018-11-24 01:48:25 +0100
commit1ebef0a393ddbc27a1e6071d8364b43a42277c77 (patch)
tree3d43f20ab0c3c9903b11b06a14d693ee2ea17ea0 /vmemalloc.c
parentAdd tests (diff)
downloadlibsimple-1ebef0a393ddbc27a1e6071d8364b43a42277c77.tar.gz
libsimple-1ebef0a393ddbc27a1e6071d8364b43a42277c77.tar.bz2
libsimple-1ebef0a393ddbc27a1e6071d8364b43a42277c77.tar.xz
Add [raw]memelem{cpy,move}
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--vmemalloc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/vmemalloc.c b/vmemalloc.c
index f79ebb0..8d92035 100644
--- a/vmemalloc.c
+++ b/vmemalloc.c
@@ -183,7 +183,7 @@ void *
libsimple_vmemalloc(size_t n, va_list ap) /* TODO test ([v]{mem,array}alloc) */
{
struct memalloc_state state;
- size_t misalignment, size, cacheline, min, max;
+ size_t misalignment, size, cacheline = 64, min, max;
void *ptr = NULL;
int saved_errno;
long int tmp;
@@ -225,10 +225,10 @@ libsimple_vmemalloc(size_t n, va_list ap) /* TODO test ([v]{mem,array}alloc) */
if (state.cache_align || !state.cache_split) {
#ifdef _SC_LEVEL1_DCACHE_LINESIZE
tmp = sysconf(_SC_LEVEL1_DCACHE_LINESIZE);
- cacheline = (size_t)(tmp < 1 ? 64L : tmp);
+ if (tmp >= 1)
+ cacheline = (size_t)tmp;
#else
(void) tmp;
- cacheline = 64;
#endif
}