comparison ListOfArrays.h @ 8:0e6cc9d9ec67

on MC_shared brch, changed VMS__malloc to VMS_int__malloc and added .hgeol
author Some Random Person <seanhalle@yahoo.com>
date Fri, 09 Mar 2012 22:14:24 -0800
parents 79982974d355
children f75ec4738afc
comparison
equal deleted inserted replaced
5:0b9b647e647a 6:658001b85aff
7 7
8 #ifndef LISTOFARRAYS_H 8 #ifndef LISTOFARRAYS_H
9 #define LISTOFARRAYS_H 9 #define LISTOFARRAYS_H
10 10
11 #include<stddef.h> 11 #include<stddef.h>
12 #include "../DynArray/DynArray.h" 12 #include "DynArray/DynArray.h"
13 13
14 14
15 typedef struct { 15 typedef struct {
16 void* next; 16 void* next;
17 void* data; 17 void* data;
29 ListOfArrays* makeListOfArrays(size_t entry_size, int num_entries_per_block); 29 ListOfArrays* makeListOfArrays(size_t entry_size, int num_entries_per_block);
30 30
31 #define addToListOfArrays(type,value,list) do { \ 31 #define addToListOfArrays(type,value,list) do { \
32 int offset_in_fragment = list->next_free_index % list->num_entries_per_fragment; \ 32 int offset_in_fragment = list->next_free_index % list->num_entries_per_fragment; \
33 if(offset_in_fragment == 0){ \ 33 if(offset_in_fragment == 0){ \
34 void* newBlock = VMS__malloc(list->entry_size * list->num_entries_per_fragment); \ 34 void* newBlock = VMS_int__malloc(list->entry_size * list->num_entries_per_fragment); \
35 addToDynArray(newBlock,list->dim1info); \ 35 addToDynArray(newBlock,list->dim1info); \
36 } \ 36 } \
37 type* typedFragment = (type*) ((list->dim1)[list->dim1info->numInArray -1]); \ 37 type* typedFragment = (type*) ((list->dim1)[list->dim1info->numInArray -1]); \
38 typedFragment[offset_in_fragment] = value; \ 38 typedFragment[offset_in_fragment] = value; \
39 list->next_free_index++; \ 39 list->next_free_index++; \