#ifndef PATRICIA_H_
#define PATRICIA_H_

#include <typedef.h>

#define MAX(x,y) x > y ? x : y
#define MIN(x,y) x > y ? y : x

#pragma pack(1)

struct patriciaNode_t {
	struct patriciaNode_t *left;
	struct patriciaNode_t *right;
	uint32t bit;
	char *str;
	uint32t value;
};

#pragma pack()

static inline uint8t getBits(char *str, uint32t bit) {	
	return (str[bit >> 3] & (1 << (bit & 7)));
}

void patriciaInit(void *mem);
struct patriciaNode_t *patriciaDeinit();
void *patriciaGetEndMem();
void patriciaInsertStr(char *str, uint32t val);
uint32t patriciaGetValue(char *str);

#endif