spl

a Simple Programming Language
Log | Files | Refs

array.h (395B)


      1 #ifndef __ARRAY_H_
      2 #define __ARRAY_H_
      3 
      4 #include <stdint.h>
      5 
      6 typedef struct array {
      7 	uint64_t cap, len;	/* cap in bytes, len in bytes */
      8 	uint32_t size;		/* size of elements in bytes */
      9 	void *arr;
     10 } array;
     11 
     12 array *newarray(int cap, int size);
     13 void *indexarray(array *a, int index);
     14 void resizearray(array *a, int new);
     15 void appendarray(array *a, void *item);
     16 void destroyarray(array *a);
     17 #endif