Browse Source

Add find_line

master
Adam Goldsmith 6 years ago
parent
commit
a31fde98e4
  1. 12
      csim.c

12
csim.c

@ -197,6 +197,18 @@ void print_set(linked_line* line) @@ -197,6 +197,18 @@ void print_set(linked_line* line)
}
}
/**
@returns the first line with a matching tag, the first invalid line,
or the first line without an older (i.e. the end of the set
*/
linked_line* find_line(linked_line* line, long tag)
{
if(line->tag == tag || !line->validity || !line->older)
return line;
else
return find_line(line->older, tag);
}
void print_usage(void)
{
printf("Usage: ./csim [-hv] -s <number> -E <number> -b <number> -t <file>\n"