X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=support%2Ftests%2Fdhrystone%2Fdhry.c;h=2dda65b1d409498ba5bf594c9267a3a64224ceae;hb=88ff7c7ef31872af21690ba5adf82200bb7a6c1e;hp=f5acdc081f41d1150912862da177ae0002ba2869;hpb=714f7177aa7cea806993b5360242242cd16536df;p=fw%2Fsdcc diff --git a/support/tests/dhrystone/dhry.c b/support/tests/dhrystone/dhry.c index f5acdc08..2dda65b1 100644 --- a/support/tests/dhrystone/dhry.c +++ b/support/tests/dhrystone/dhry.c @@ -43,11 +43,9 @@ #include /** For printf */ #include - -/** Returns the current device time in ticks. Check HZ in the Makefile - as well - HZ ticks = 1 second. -*/ -unsigned _clock(void); +/** For clock() */ +#include +#include /** Print the number of t-states this program has been executing for. Optional :) @@ -73,7 +71,6 @@ char Ch_1_Glob, int Arr_1_Glob [50]; int Arr_2_Glob [50] [50]; - /* Used instead of malloc() */ static Rec_Type _r[2]; @@ -90,11 +87,7 @@ Enumeration Func_1 (Capital_Letter Ch_1_Par_Val, Capital_Letter Ch_2_Par_Val); Boolean Func_2 (char *Str_1_Par_Ref, char *Str_2_Par_Ref); Boolean Func_3 (Enumeration Enum_Par_Val); -#if SDCC -int _main(void) -#else int main(void) -#endif { One_Fifty Int_1_Loc; REG One_Fifty Int_2_Loc; @@ -112,6 +105,7 @@ int main(void) Next_Ptr_Glob = &_r[0]; Ptr_Glob = &_r[1]; + Ptr_Glob->Ptr_Comp = Next_Ptr_Glob; Ptr_Glob->Discr = Ident_1; Ptr_Glob->variant.var_1.Enum_Comp = Ident_3; @@ -131,7 +125,7 @@ int main(void) /* 32766 is the highest value for a 16 bitter */ Number_Of_Runs = 32766; - runTime = _clock(); + runTime = clock(); /* Main test loop */ for (Run_Index = 1; Run_Index <= Number_Of_Runs; ++Run_Index) { @@ -165,7 +159,7 @@ int main(void) Int_1_Loc, Int_2_Loc, Int_3_Loc)); DPRINTF(("Proc_8\n")); - Proc_8 (Arr_1_Glob, Arr_2_Glob, Int_1_Loc, Int_3_Loc); + Proc_8 (Arr_1_Glob, (int *)Arr_2_Glob, Int_1_Loc, Int_3_Loc); /* Int_Glob == 5 */ DPRINTF(("Int_Glob %d == 5\n", Int_Glob)); DPRINTF(("Proc_1\n")); @@ -205,7 +199,7 @@ int main(void) printf("Run_Index = %d\n", Run_Index); - runTime = _clock() - runTime; + runTime = clock() - runTime; printf ("Execution ends\n"); printf ("\n"); @@ -261,7 +255,7 @@ int main(void) printf ("\n"); printf("Time: %u ticks\n", runTime); - printf("Dhrystones/s = %u\n", Number_Of_Runs / (runTime/HZ)); + printf("Dhrystones/s = %u\n", Number_Of_Runs / (runTime/CLOCKS_PER_SEC)); printf("MIPS = d/s/1757 = (sigh, need floats...)\n"); _printTStates(); } @@ -309,17 +303,17 @@ void Proc_2 (One_Fifty *Int_Par_Ref) Int_Loc = *Int_Par_Ref + 10; do { - DPRINTF(("1\n")); + DPRINTF(("1")); /* executed once */ if (Ch_1_Glob == 'A') /* then, executed */ { - DPRINTF(("2\n")); + DPRINTF(("2")); Int_Loc -= 1; *Int_Par_Ref = Int_Loc - Int_Glob; Enum_Loc = Ident_1; } /* if */ - DPRINTF(("3\n")); + DPRINTF(("3")); } while (Enum_Loc != Ident_1); /* true */ DPRINTF(("Proc_2 done.\n")); } /* Proc_2 */