cleaner config and silent warnings
This commit is contained in:
parent
4d6667b0e0
commit
009bf9e010
|
@ -7,10 +7,9 @@
|
||||||
#include "picrin/private/khash.h"
|
#include "picrin/private/khash.h"
|
||||||
#include "picrin/private/state.h"
|
#include "picrin/private/state.h"
|
||||||
|
|
||||||
enum {
|
#ifndef PIC_MEMALIGN
|
||||||
WHITE = 0,
|
# error "bitmapgc requires PIC_MEMALIGN"
|
||||||
BLACK = 1
|
#endif
|
||||||
};
|
|
||||||
|
|
||||||
union header {
|
union header {
|
||||||
struct {
|
struct {
|
||||||
|
@ -194,7 +193,7 @@ numofbits(unsigned long bits)
|
||||||
{
|
{
|
||||||
bits = bits - (bits >> 1 & 0x55555555);
|
bits = bits - (bits >> 1 & 0x55555555);
|
||||||
bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
|
bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
|
||||||
bits = bits + (bits >> 4) & 0x0f0f0f0f;
|
bits = bits + ((bits >> 4) & 0x0f0f0f0f);
|
||||||
bits = bits * 0x01010101;
|
bits = bits * 0x01010101;
|
||||||
|
|
||||||
return bits >> 24;
|
return bits >> 24;
|
||||||
|
@ -287,11 +286,8 @@ static void
|
||||||
heap_morecore(pic_state *pic)
|
heap_morecore(pic_state *pic)
|
||||||
{
|
{
|
||||||
struct heap_page *page;
|
struct heap_page *page;
|
||||||
size_t nunits;
|
|
||||||
|
|
||||||
nunits = (PIC_HEAP_PAGE_SIZE - sizeof(struct heap_page)) / sizeof(union header);
|
assert((2 <= PIC_HEAP_PAGE_SIZE - sizeof(struct heap_page)) / sizeof(union header));
|
||||||
|
|
||||||
assert(nunits >= 2);
|
|
||||||
|
|
||||||
if(PIC_MEMALIGN(pic, (void **)&page, PIC_HEAP_PAGE_SIZE, PIC_HEAP_PAGE_SIZE) != 0)
|
if(PIC_MEMALIGN(pic, (void **)&page, PIC_HEAP_PAGE_SIZE, PIC_HEAP_PAGE_SIZE) != 0)
|
||||||
pic_panic(pic, "memory exhausted");
|
pic_panic(pic, "memory exhausted");
|
||||||
|
|
|
@ -170,10 +170,11 @@ typedef unsigned long uint32_t;
|
||||||
# ifndef PIC_MEMALIGN
|
# ifndef PIC_MEMALIGN
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# define PIC_MEMALIGN(pic, buf, alignment, size) posix_memalign(buf, alignment, size)
|
# define PIC_MEMALIGN(pic, buf, alignment, size) posix_memalign(buf, alignment, size)
|
||||||
|
# endif
|
||||||
|
# ifndef PIC_USE_BITMAPGC
|
||||||
# define PIC_USE_BITMAPGC
|
# define PIC_USE_BITMAPGC
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
# define assert(v) (void)0
|
# define assert(v) (void)0
|
||||||
|
|
Loading…
Reference in New Issue