+/* Licensed under LGPLv2.1+ - see LICENSE file for details */
#include <unistd.h>
#include <stdint.h>
#include <string.h>
*/
static unsigned int size_to_bucket(unsigned long size)
{
- unsigned int base = fls(size/2);
+ unsigned int base = afls(size/2);
unsigned long overshoot;
overshoot = size - (1UL << base);
static unsigned int small_page_bits(unsigned long poolsize)
{
- return fls(poolsize / MAX_SMALL_PAGES - 1);
+ return afls(poolsize / MAX_SMALL_PAGES - 1);
}
static struct page_header *from_pgnum(struct header *head,
unsigned int i;
for (i = 0; bitmap[i] == -1UL; i++);
- return (i*BITS_PER_LONG) + ffsl(~bitmap[i]) - 1;
+ return (i*BITS_PER_LONG) + affsl(~bitmap[i]) - 1;
}
/* How many elements can we fit in a page? */
for (i = 0; i < SMALL_PAGES_PER_LARGE_PAGE; i++) {
del_from_list(head, &head->small_free_list,
- (struct page_header *)((char *)ph
+ (struct page_header *)((char *)ph
+ (i << sp_bits)),
sp_bits);
}
struct page_header *ph;
if (poolsize < MIN_USEFUL_SIZE) {
- return tiny_alloc_free(pool, poolsize, free);
+ tiny_alloc_free(pool, poolsize, free);
+ return;
}
/* Get page header. */