Browse Source

Fix number of sets/lines created

masstesting
Adam Goldsmith 6 years ago
parent
commit
c26d27db9d
  1. 5
      csim.c

5
csim.c

@ -131,7 +131,7 @@ linked_line** make_cache(long set_indices, long num_lines) @@ -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) @@ -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;