Fix number of sets/lines created
This commit is contained in:
parent
b556be1622
commit
c26d27db9d
5
csim.c
5
csim.c
@ -131,7 +131,7 @@ linked_line** make_cache(long set_indices, long num_lines)
|
||||
{
|
||||
linked_line** cache = (linked_line**)calloc(set_indices, sizeof(linked_line*));
|
||||
long ii;
|
||||
for (ii = 0; ii < num_lines; ii++) {
|
||||
for (ii = 0; ii < set_indices; ii++) {
|
||||
cache[ii] = make_set(NULL, num_lines);
|
||||
}
|
||||
return cache;
|
||||
@ -146,8 +146,9 @@ linked_line** make_cache(long set_indices, long num_lines)
|
||||
linked_line* make_set(linked_line* newer, long num_lines) {
|
||||
linked_line* current = (linked_line*)calloc(1, sizeof(linked_line));
|
||||
current->newer = newer;
|
||||
num_lines--;
|
||||
if (num_lines) { // If not on the last line
|
||||
current->older = make_set(current, num_lines-1);
|
||||
current->older = make_set(current, num_lines);
|
||||
}
|
||||
else {
|
||||
current->older = NULL;
|
||||
|
Reference in New Issue
Block a user