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.
 
 
 
 

11 lines
325 B

#include "iarray.h"
void* iarray_get(iarray* ia,size_t pos) {
size_t index;
iarray_page* p=ia->pages[pos%(sizeof(ia->pages)/sizeof(ia->pages[0]))];
for (index=0; p; p=p->next, index+=ia->elemperpage) {
if (pos>=index && pos<index+ia->elemperpage)
return &p->data[(pos-index)*ia->elemsize];
}
return 0;
}