~vamsi-krishnak/+junk/discrete-algorithms-0.9

« back to all changes in this revision

Viewing changes to DynamicBuffer.h

  • Committer: Vamsi Kundeti
  • Date: 2010-01-26 02:16:32 UTC
  • Revision ID: vamsi.krishnak@gmail.com-20100126021632-xmhc60dv0dizysfl
Added a new data-structure 'DynamicBuffer' and 'BitArray' and a useful rounding routine using
bit-wise operators

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*DynamicBuffer a simple data-structure to model expandable graphs*/
 
2
#ifndef __DYNAMIC_BUFFER_MY_UTIL
 
3
#define __DYNAMIC_BUFFER_MY_UTIL 1
 
4
#ifdef __cplusplus
 
5
extern "C" { 
 
6
#endif
 
7
#define DBUFFER_INCREMENT 1024
 
8
/*The total buffer space occupied is bsize*usize */
 
9
typedef struct _dbuffer_ {
 
10
        unsigned char *buffer;
 
11
        /*next available index for a push*/
 
12
        unsigned long bidx; 
 
13
        /*Current Size of the buffer*/
 
14
        unsigned long bsize;
 
15
        /*size of one unit in bytes*/
 
16
        unsigned char usize;
 
17
}DBuffer;
 
18
void InitDBuffer(DBuffer *, unsigned char usize);
 
19
void DBufferPush(DBuffer *, void *);
 
20
#ifdef __cplusplus
 
21
}
 
22
#endif
 
23
#endif