1
0
mirror of https://github.com/cc65/cc65.git synced 2025-04-08 19:38:55 +00:00

Fixed printf format types, and don't act like a test.

This commit is contained in:
sidney 2025-01-05 16:16:13 +01:00
parent 988260c699
commit aca6b33af7

View File

@ -41,7 +41,6 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <sim65.h>
static uint32_t timestamp(void)
@ -67,9 +66,9 @@ int main(void)
{
unsigned max_term;
unsigned long result;
uint32_t t1, t2, overhead, duration;
int32_t d0, d1;
int32_t predicted_duration;
uint32_t t1, t2, overhead;
int32_t d0, d1, duration;
int32_t predicted_duration;
/* Calibration measurement of zero clock cycles, to determine the overhead. */
@ -101,9 +100,11 @@ int main(void)
max_term = 10000;
predicted_duration = d0 + max_term * (d1 - d0);
printf("predicted duration for max_term = %u: %lu\n", max_term, predicted_duration);
printf("predicted duration for max_term = %u: %ld\n", max_term, predicted_duration);
/* Do the actual measurement for max_term = 10000. */
/* Do the actual measurement for max_term = 10000.
* Note: equality between the prediction and the measurement is only achieved if we compile with -O.
*/
t1 = timestamp();
result = calc_sum_terms(max_term);
@ -111,7 +112,6 @@ int main(void)
duration = (t2 - t1) - overhead;
printf("max_term = %u -> result = %lu; duration = %ld\n", max_term, result, duration);
/* Report success or failure. */
return (duration == predicted_duration) ? EXIT_SUCCESS : EXIT_FAILURE;
return 0;
}