~cpick/mongrel2/release

« back to all changes in this revision

Viewing changes to src/adt/radixmap.h

  • Committer: Chris Pick
  • Date: 2013-06-30 16:39:57 UTC
  • mfrom: (1106.1.15)
  • Revision ID: git-v1:ec39967acb6bc9867ed9b9dc3774304ca6b9c294
Merge tag 'v1.8.1' into debian

Hotfix for github issue 148

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef _radixmap_h
 
2
#include <stdint.h>
 
3
 
 
4
typedef union RMElement {
 
5
    uint64_t raw;
 
6
    struct {
 
7
        uint32_t key;
 
8
        uint32_t value;
 
9
    } data;
 
10
} RMElement;
 
11
 
 
12
typedef struct RadixMap {
 
13
    size_t max;
 
14
    size_t end;
 
15
    uint32_t counter;
 
16
    RMElement *contents;
 
17
    RMElement *temp;
 
18
} RadixMap;
 
19
 
 
20
 
 
21
RadixMap *RadixMap_create(size_t max);
 
22
 
 
23
void RadixMap_destroy(RadixMap *map);
 
24
 
 
25
void RadixMap_sort(RadixMap *map);
 
26
 
 
27
RMElement *RadixMap_find(RadixMap *map, uint32_t key);
 
28
 
 
29
int RadixMap_add(RadixMap *map, uint32_t key, uint32_t value);
 
30
 
 
31
int RadixMap_delete(RadixMap *map, RMElement *el);
 
32
 
 
33
uint32_t RadixMap_push(RadixMap *map, uint32_t value);
 
34
 
 
35
#endif