#include "inc/priv.h"#include "inc/bitvector.h" u32int *bitvector_resize(u32int *b, u64int oldsz, u64int newsz){ usize sz = ((newsz+31)>>5) * sizeof(u32int); u32int *p = oldsz == newsz ? b : MEM_REALLOC(b, sz); if(sl_unlikely(p == nil)) return nil; if(sl_likely(newsz > oldsz)){ usize osz = ((oldsz+31)>>5) * sizeof(u32int); memset(&p[osz/sizeof(u32int)], 0, sz-osz); } return p;}
#include "inc/priv.h"
#include "inc/bitvector.h"
u32int *
bitvector_resize(u32int *b, u64int oldsz, u64int newsz)
{
usize sz = ((newsz+31)>>5) * sizeof(u32int);
u32int *p = oldsz == newsz ? b : MEM_REALLOC(b, sz);
if(sl_unlikely(p == nil))
return nil;
if(sl_likely(newsz > oldsz)){
usize osz = ((oldsz+31)>>5) * sizeof(u32int);
memset(&p[osz/sizeof(u32int)], 0, sz-osz);
}
return p;
}