mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-27 03:41:23 +08:00
Replace divide and multiply with mask in sYSTRIm
This commit is contained in:
parent
004c737f7b
commit
b9b42ee01c
@ -1,3 +1,8 @@
|
||||
2010-07-26 Anton Blanchard <anton@samba.org>
|
||||
|
||||
* malloc/malloc.c (sYSTRIm): Replace divide and multiply with mask.
|
||||
* malloc/arena.c (heap_trim): Likewise.
|
||||
|
||||
2010-08-16 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* sysdeps/unix/sysv/linux/syscalls.list: Add entry for fanotify_init
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Malloc implementation for multiple threads without lock contention.
|
||||
Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2009
|
||||
Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2009,2010
|
||||
Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Wolfram Gloger <wg@malloc.de>, 2001.
|
||||
@ -879,7 +879,7 @@ heap_trim(heap, pad) heap_info *heap; size_t pad;
|
||||
/*check_chunk(ar_ptr, top_chunk);*/
|
||||
}
|
||||
top_size = chunksize(top_chunk);
|
||||
extra = ((top_size - pad - MINSIZE + (pagesz-1))/pagesz - 1) * pagesz;
|
||||
extra = (top_size - pad - MINSIZE - 1) & ~(pagesz - 1);
|
||||
if(extra < (long)pagesz)
|
||||
return 0;
|
||||
/* Try to shrink. */
|
||||
|
@ -3466,7 +3466,7 @@ static int sYSTRIm(pad, av) size_t pad; mstate av;
|
||||
top_size = chunksize(av->top);
|
||||
|
||||
/* Release in pagesize units, keeping at least one page */
|
||||
extra = ((top_size - pad - MINSIZE + (pagesz-1)) / pagesz - 1) * pagesz;
|
||||
extra = (top_size - pad - MINSIZE - 1) & ~(pagesz - 1);
|
||||
|
||||
if (extra > 0) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user