Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat https://www.fefe.de/libowfat/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

16 lines
402 B

#include "iarray.h"
void iarray_init(iarray* ia,size_t elemsize) {
size_t i;
ia->elemsize=elemsize;
for (i=0; i<sizeof(ia->pages)/sizeof(ia->pages[0]); ++i)
ia->pages[i]=0;
if (elemsize<1024)
ia->bytesperpage=4096;
else if (elemsize<8192)
ia->bytesperpage=65536;
else
ia->bytesperpage=elemsize+sizeof(void*);
ia->elemperpage=(ia->bytesperpage-sizeof(void*))/elemsize;
}