libowfat/array/iarray_get.c
2009-03-12 21:32:43 +00:00

13 lines
260 B
C

#include "iarray.h"
void* iarray_get(iarray* ia,size_t pos) {
char* x;
size_t y;
if (!ia->pages) return 0;
y=pos/ia->elemperpage;
if (y>=ia->pagefence) return 0;
x=ia->pages[y];
if (!x) return 0;
return x+(pos%ia->elemperpage)*ia->elemsize;
}