summaryrefslogtreecommitdiff
path: root/malloc.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2020-05-29 14:25:19 -0600
committerKarl Williamson <khw@cpan.org>2020-07-17 22:04:08 -0600
commitd223e1ea9ae864c0e563187f1e76240ef1acad87 (patch)
treef670961d58ff3c055cff40637ca9daacaf1b462e /malloc.c
parent0654f0ab17405d0d55f0006348b4ed0084aa1fc8 (diff)
downloadperl-d223e1ea9ae864c0e563187f1e76240ef1acad87.tar.gz
handy.h: Create nBIT_MASK(n) macro
This encapsulates a common paradigm, making sure that it is done correctly for the platform's size.
Diffstat (limited to 'malloc.c')
-rw-r--r--malloc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/malloc.c b/malloc.c
index 337efa8008..9e5ff76fba 100644
--- a/malloc.c
+++ b/malloc.c
@@ -596,7 +596,7 @@ static const u_short buck_size[MAX_BUCKET_BY_TABLE + 1] =
# define MAX_PACKED_POW2 6
# define MAX_PACKED (MAX_PACKED_POW2 * BUCKETS_PER_POW2 + BUCKET_POW2_SHIFT)
# define MAX_POW2_ALGO ((1<<(MAX_PACKED_POW2 + 1)) - M_OVERHEAD)
-# define TWOK_MASK ((1<<LOG_OF_MIN_ARENA) - 1)
+# define TWOK_MASK nBITMASK(LOG_OF_MIN_ARENA)
# define TWOK_MASKED(x) (PTR2UV(x) & ~TWOK_MASK)
# define TWOK_SHIFT(x) (PTR2UV(x) & TWOK_MASK)
# define OV_INDEXp(block) (INT2PTR(u_char*,TWOK_MASKED(block)))
@@ -618,7 +618,7 @@ static const u_short buck_size[MAX_BUCKET_BY_TABLE + 1] =
#ifdef IGNORE_SMALL_BAD_FREE
#define FIRST_BUCKET_WITH_CHECK (6 * BUCKETS_PER_POW2) /* 64 */
# define N_BLKS(bucket) ( (bucket) < FIRST_BUCKET_WITH_CHECK \
- ? ((1<<LOG_OF_MIN_ARENA) - 1)/BUCKET_SIZE_NO_SURPLUS(bucket) \
+ ? nBIT_MASK(LOG_OF_MIN_ARENA)/BUCKET_SIZE_NO_SURPLUS(bucket) \
: n_blks[bucket] )
#else
# define N_BLKS(bucket) n_blks[bucket]