You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
325 B
C
12 lines
325 B
C
#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;
|
|
}
|