-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray.h
More file actions
28 lines (24 loc) · 1.29 KB
/
Copy patharray.h
File metadata and controls
28 lines (24 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
struct Array {
unsigned int width;
unsigned int nel;
unsigned int capacity;
void *data;
};
struct Performance{
unsigned int reads;
unsigned int writes;
unsigned int mallocs;
unsigned int frees;
};
struct Performance *newPerformance();
struct Array *newArray(struct Performance *performance, unsigned int width, unsigned int capacity);
void readItem(struct Performance *performance, struct Array *array, unsigned int index, void *dest);
void writeItem(struct Performance *performance, struct Array *array, unsigned int index, void *src);
void contract(struct Performance *performance, struct Array *array);
void freeArray(struct Performance *performance, struct Array *array);
void appendItem(struct Performance *performance, struct Array *array, void *src);
void insertItem(struct Performance *performance, struct Array *array, unsigned int index, void *src);
void prependItem(struct Performance *performance, struct Array *array, void *src);
void deleteItem(struct Performance *performance, struct Array *array, unsigned int index);
int findItem(struct Performance *performance, struct Array *array, int (*compar)(const void *, const void *), void *target);
int searchItem(struct Performance *performance, struct Array *array, int (*compar)(const void *, const void *), void *target);