cleaner config and silent warnings

This commit is contained in:
Sunrin SHIMURA (keen) 2016-06-19 09:20:36 +09:00
parent 4d6667b0e0
commit 009bf9e010
2 changed files with 7 additions and 10 deletions

View File

@ -7,10 +7,9 @@
#include "picrin/private/khash.h"
#include "picrin/private/state.h"
enum {
WHITE = 0,
BLACK = 1
};
#ifndef PIC_MEMALIGN
# error "bitmapgc requires PIC_MEMALIGN"
#endif
union header {
struct {
@ -194,7 +193,7 @@ numofbits(unsigned long bits)
{
bits = bits - (bits >> 1 & 0x55555555);
bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
bits = bits + (bits >> 4) & 0x0f0f0f0f;
bits = bits + ((bits >> 4) & 0x0f0f0f0f);
bits = bits * 0x01010101;
return bits >> 24;
@ -287,11 +286,8 @@ static void
heap_morecore(pic_state *pic)
{
struct heap_page *page;
size_t nunits;
nunits = (PIC_HEAP_PAGE_SIZE - sizeof(struct heap_page)) / sizeof(union header);
assert(nunits >= 2);
assert((2 <= PIC_HEAP_PAGE_SIZE - sizeof(struct heap_page)) / sizeof(union header));
if(PIC_MEMALIGN(pic, (void **)&page, PIC_HEAP_PAGE_SIZE, PIC_HEAP_PAGE_SIZE) != 0)
pic_panic(pic, "memory exhausted");

View File

@ -170,10 +170,11 @@ typedef unsigned long uint32_t;
# ifndef PIC_MEMALIGN
# include <unistd.h>
# define PIC_MEMALIGN(pic, buf, alignment, size) posix_memalign(buf, alignment, size)
# endif
# ifndef PIC_USE_BITMAPGC
# define PIC_USE_BITMAPGC
# endif
#else
# define assert(v) (void)0