one_bit.h

来自「单比特树查找算法」· C头文件 代码 · 共 52 行

H
52 行
字号
/*b_tree.h*/
#ifndef _STATV6_H
#define _STATV6_H

#include "global.h"

#define MAXKEY 35

typedef struct node
{
	struct node *lchild;
	struct node *rchild;
	val16_t nh;
	uchar len;
	bool real_entry;
	val32_t prefix[4];
#ifndef _DEBUG_
	int level;
#endif	
}node_t;


/*construct an oridinary tree*/
int construct_tree(val32_t pre[4], val16_t next_hop, int length);

/*initialize an oridinary tree node*/
node_t * initialize_node(node_t *treenode);

void stat();

/*release an oridinary tree node*/
bool release_node(node_t *root);

bool traverse_tree(node_t *node);

static void preorderTraverse(node_t *node);

/*return the bit value of the designed position, and it is from left to right and start from 0*/
bool bit_value(val32_t prefix, int position);

bool bit_value6(val32_t *prefix, int position);

val32_t *copy(val32_t *prefix, val32_t *result);

int compare(val32_t *pre1, val32_t *pre2);

val8_t search_tree(val32_t *prefix);


#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?