Implement PAGE_FLOOR macro
diff --git a/include/jemalloc/internal/pages.h b/include/jemalloc/internal/pages.h
index 3d7993d..ad1f606 100644
--- a/include/jemalloc/internal/pages.h
+++ b/include/jemalloc/internal/pages.h
@@ -13,6 +13,9 @@
/* Return the smallest pagesize multiple that is >= s. */
#define PAGE_CEILING(s) \
(((s) + PAGE_MASK) & ~PAGE_MASK)
+/* Return the largest pagesize multiple that is <=s. */
+#define PAGE_FLOOR(s) \
+ ((s) & ~PAGE_MASK)
/* Huge page size. LG_HUGEPAGE is determined by the configure script. */
#define HUGEPAGE ((size_t)(1U << LG_HUGEPAGE))
diff --git a/src/sec.c b/src/sec.c
index 6fffaf1..c13904d 100644
--- a/src/sec.c
+++ b/src/sec.c
@@ -25,7 +25,7 @@
const sec_opts_t *opts) {
assert(opts->max_alloc > 0);
- size_t max_alloc = opts->max_alloc & ~PAGE_MASK;
+ size_t max_alloc = PAGE_FLOOR(opts->max_alloc);
pszind_t npsizes = sz_psz2ind(max_alloc) + 1;
size_t sz_shards = opts->nshards * sizeof(sec_shard_t);