format
This commit is contained in:
parent
a967a59145
commit
37ca8ca5bf
67
a.txt
67
a.txt
|
@ -31,39 +31,40 @@ make[2]: Leaving directory '/home/eason/Documents/project/HW11'
|
|||
[100%] Built target homework_11
|
||||
make[1]: Leaving directory '/home/eason/Documents/project/HW11'
|
||||
/usr/bin/cmake -E cmake_progress_start /home/eason/Documents/project/HW11/CMakeFiles 0
|
||||
the number of prefixes with prefix length 0 = 0
|
||||
the number of prefixes with prefix length 1 = 0
|
||||
the number of prefixes with prefix length 2 = 0
|
||||
the number of prefixes with prefix length 3 = 1
|
||||
the number of prefixes with prefix length 4 = 0
|
||||
the number of prefixes with prefix length 5 = 1
|
||||
the number of prefixes with prefix length 6 = 3
|
||||
the number of prefixes with prefix length 7 = 4
|
||||
the number of prefixes with prefix length 8 = 107
|
||||
the number of prefixes with prefix length 9 = 3
|
||||
the number of prefixes with prefix length 10 = 5
|
||||
the number of prefixes with prefix length 11 = 9
|
||||
the number of prefixes with prefix length 12 = 47
|
||||
the number of prefixes with prefix length 13 = 70
|
||||
the number of prefixes with prefix length 14 = 164
|
||||
the number of prefixes with prefix length 15 = 317
|
||||
the number of prefixes with prefix length 16 = 6117
|
||||
the number of prefixes with prefix length 17 = 1083
|
||||
the number of prefixes with prefix length 18 = 1769
|
||||
the number of prefixes with prefix length 19 = 4489
|
||||
the number of prefixes with prefix length 20 = 5553
|
||||
the number of prefixes with prefix length 21 = 4246
|
||||
the number of prefixes with prefix length 22 = 6090
|
||||
the number of prefixes with prefix length 23 = 7772
|
||||
the number of prefixes with prefix length 24 = 43679
|
||||
the number of prefixes with prefix length 25 = 383
|
||||
the number of prefixes with prefix length 26 = 387
|
||||
the number of prefixes with prefix length 27 = 439
|
||||
the number of prefixes with prefix length 28 = 338
|
||||
the number of prefixes with prefix length 29 = 989
|
||||
the number of prefixes with prefix length 30 = 454
|
||||
the number of prefixes with prefix length 31 = 1
|
||||
the number of prefixes with prefix length 32 = 113
|
||||
The total number of prefixes in the input file is : 84633.
|
||||
the number of prefixes with prefix length 0 = 0.
|
||||
the number of prefixes with prefix length 1 = 0.
|
||||
the number of prefixes with prefix length 2 = 0.
|
||||
the number of prefixes with prefix length 3 = 1.
|
||||
the number of prefixes with prefix length 4 = 0.
|
||||
the number of prefixes with prefix length 5 = 1.
|
||||
the number of prefixes with prefix length 6 = 3.
|
||||
the number of prefixes with prefix length 7 = 4.
|
||||
the number of prefixes with prefix length 8 = 107.
|
||||
the number of prefixes with prefix length 9 = 3.
|
||||
the number of prefixes with prefix length 10 = 5.
|
||||
the number of prefixes with prefix length 11 = 9.
|
||||
the number of prefixes with prefix length 12 = 47.
|
||||
the number of prefixes with prefix length 13 = 70.
|
||||
the number of prefixes with prefix length 14 = 164.
|
||||
the number of prefixes with prefix length 15 = 317.
|
||||
the number of prefixes with prefix length 16 = 6117.
|
||||
the number of prefixes with prefix length 17 = 1083.
|
||||
the number of prefixes with prefix length 18 = 1769.
|
||||
the number of prefixes with prefix length 19 = 4489.
|
||||
the number of prefixes with prefix length 20 = 5553.
|
||||
the number of prefixes with prefix length 21 = 4246.
|
||||
the number of prefixes with prefix length 22 = 6090.
|
||||
the number of prefixes with prefix length 23 = 7772.
|
||||
the number of prefixes with prefix length 24 = 43679.
|
||||
the number of prefixes with prefix length 25 = 383.
|
||||
the number of prefixes with prefix length 26 = 387.
|
||||
the number of prefixes with prefix length 27 = 439.
|
||||
the number of prefixes with prefix length 28 = 338.
|
||||
the number of prefixes with prefix length 29 = 989.
|
||||
the number of prefixes with prefix length 30 = 454.
|
||||
the number of prefixes with prefix length 31 = 1.
|
||||
the number of prefixes with prefix length 32 = 113.
|
||||
| 00000000 |
|
||||
| 00000001 | ---> | 1.0.0.0 |
|
||||
| 00000010 | ---> | 2.0.0.0 |
|
||||
|
|
BIN
homework_11
BIN
homework_11
Binary file not shown.
7
src/v1.c
7
src/v1.c
|
@ -7,18 +7,23 @@
|
|||
|
||||
void input(struct State* state){
|
||||
FILE * table = fopen("routing_table.txt","r");
|
||||
usize amount=0;
|
||||
|
||||
while(true){
|
||||
char buffer[20]={'\0'};
|
||||
fgets(buffer,20,table);
|
||||
if(*buffer=='\0') break;
|
||||
|
||||
amount++;
|
||||
|
||||
struct SizedSubmask* mask=malloc(sizeof(struct SizedSubmask));
|
||||
parse_submask(buffer,mask);
|
||||
if(mask<10000)printf("%zu\n",mask);
|
||||
|
||||
state->head=xor_insert_mid(NULL,state->head,mask);
|
||||
}
|
||||
printf("The total number of prefixes in the input file is : %zu.\n",amount);
|
||||
|
||||
}
|
||||
|
||||
void length_distribution(struct State* state){
|
||||
|
@ -37,5 +42,5 @@ void length_distribution(struct State* state){
|
|||
}
|
||||
|
||||
for(usize i=0;i<=32;i++)
|
||||
printf("the number of prefixes with prefix length %zu = %zu\n",i,lens[i]);
|
||||
printf("the number of prefixes with prefix length %zu = %zu.\n",i,lens[i]);
|
||||
}
|
8
src/v3.c
8
src/v3.c
|
@ -58,7 +58,7 @@ void prefix_insert(struct State* state){
|
|||
parse_submask(buffer,mask);
|
||||
struct SizedSubmask* ip=clone_submask(mask);
|
||||
|
||||
// record_start
|
||||
record_start
|
||||
|
||||
if(reduce_submask(mask)){
|
||||
struct Node* ll=hash_pop(state->hashmap,mask);
|
||||
|
@ -67,7 +67,7 @@ void prefix_insert(struct State* state){
|
|||
hash_insert(state->hashmap,mask,new);
|
||||
}else state->head=xor_insert_mid(NULL,state->head,ip);
|
||||
|
||||
// record_end("prefix_insert.csv")
|
||||
record_end("prefix_insert.csv")
|
||||
|
||||
freq++;
|
||||
}
|
||||
|
@ -93,6 +93,9 @@ void prefix_delete(struct State* state){
|
|||
|
||||
if(reduce_submask(mask)){
|
||||
struct Node* ll=hash_pop(state->hashmap,mask);
|
||||
if(ll==NULL){
|
||||
log_warn("not found");
|
||||
}
|
||||
struct Node* new_head=xor_remove_match(ll,ip,eq_v3);
|
||||
|
||||
if(new_head!=NULL)hash_insert(state->hashmap,mask,new_head);
|
||||
|
@ -105,7 +108,6 @@ void prefix_delete(struct State* state){
|
|||
|
||||
record_end("prefix_delete.csv")
|
||||
|
||||
|
||||
free(ip);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue