summaryrefslogtreecommitdiff
path: root/mallocx.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-08-03 07:53:47 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-08-03 21:26:18 +0300
commita7b3a08d30e0498de3ad44c5e75bc21600ef9ff8 (patch)
tree5b9b28d7894dfdc9875ddd9967db4fe06a4da6dc /mallocx.c
parent89308bed1754cafe54e713ef950ef04727c17299 (diff)
downloadbdwgc-a7b3a08d30e0498de3ad44c5e75bc21600ef9ff8.tar.gz
Use modHBLKSZ where possible
(refactoring) * allchblk.c (GC_remove_from_fl_at, GC_add_to_fl, GC_get_first_part): Replace v&(HBLKSIZE-1) to modHBLKSZ(v). * allchblk.c [!GC_DISABLE_INCREMENTAL] (GC_allochblk_nth): Likewise. * include/private/gc_priv.h (HBLKDISPL): Likewise. * include/private/gc_hdrs.h (MAX_JUMP): Remove spaces in HBLKSIZE-1 (to match similar expressions). * include/private/gc_priv.h (OBJ_SZ_TO_BLOCKS_CHECKED): Likewise. * misc.c (block_add_size): Likewise. * os_dep.c [!MSWIN_XBOX1 && !MSWINCE && (USE_WINALLOC || CYGWIN32)] (GC_win32_get_mem): Likewise. * include/private/gc_priv.h (HBLKMASK): Remove. * include/private/gc_priv.h (obj_link): Remove extra space in the expression. * malloc.c (GC_generic_malloc_uncollectable): Replace (word)op&(HBLKSIZE-1) to HBLKDISPL(op). * mallocx.c (GC_realloc): Replace HBLKMASK to (HBLKSIZE-1).
Diffstat (limited to 'mallocx.c')
-rw-r--r--mallocx.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mallocx.c b/mallocx.c
index eb97947b..a5e2856e 100644
--- a/mallocx.c
+++ b/mallocx.c
@@ -106,7 +106,7 @@ GC_API void * GC_CALL GC_realloc(void * p, size_t lb)
/* Round it up to the next whole heap block */
word descr = GC_obj_kinds[obj_kind].ok_descriptor;
- sz = (sz + HBLKSIZE-1) & ~HBLKMASK;
+ sz = (sz + HBLKSIZE-1) & ~(HBLKSIZE-1);
if (GC_obj_kinds[obj_kind].ok_relocate_descr)
descr += sz;
/* GC_realloc might be changing the block size while */