Files

43 lines
2.2 KiB
Plaintext
Executable File

File: binarysearch.c
Original provenience: Mälardalen benchmark suite,
http://www.mrtc.mdh.se/projects/wcet/wcet_bench/bs
2015-10-10:
- Removed original header comment, replaced by TACLeBench header.
- Added prefix "binarysearch_" to all global symbols.
- Added explicit forward declarations of functions, removed obsolete forward
declaration of function binary_search.
- Replaced initialization of global array "binarysearch_data" by
TACLeBench-compliant initialization code.
- Added new global variable "binarysearch_result" to store the found return
value.
- Added new function binarysearch_return producing the searched data element as
return value.
- Removed global variable "binarysearch_cnt1" that was used for profiling.
- Added new function binarysearch_main according to TACLeBench guidelines.
binarysearch_main is annotated as entry-point for timing analysis.
- Corrected flow fact in function "binarysearch_binary_search" to cover the
interval [1, 4] instead of [4, 4].
- Applied code formatting according to the following rules
- Lines shall not be wider than 80 characters; whenever possible, appropriate
line breaks shall be inserted to keep lines below 80 characters
- Indentation is done using whitespaces only, no tabs. Code is indented by
two whitespaces
- Two empty lines are put between any two functions
- In non-empty lists or index expressions, opening '(' and '[' are followed by
one whitespace, closing ')' and ']' are preceded by one whitespace
- In comma- or colon-separated argument lists, one whitespace is put after
each comma/colon
- Names of functions and global variables all start with a benchmark-specific
prefix (here: binarysearch_) followed by lowercase letter (e.g.,
binarysearch_square)
- For pointer types, one whitespace is put before the '*'
- Operators within expressions shall be preceded and followed by one
whitespace
- Code of then- and else-parts of if-then-else statements shall be put in
separate lines, not in the same lines as the if-condition or the keyword
"else"
- Opening braces '{' denoting the beginning of code for some if-else or loop
body shall be put at the end of the same line where the keywords "if",
"else", "for", "while" etc. occur