Category : C Source Code
Archive   : PH_BENCH.ZIP
Filename : BENCHSHO.C

 
Output of file : BENCHSHO.C contained in archive : PH_BENCH.ZIP
/* benchsho - benchmark for short integers
* Thomas Plum, Plum Hall Inc, 609-927-3770
* If machine traps overflow, use an unsigned type
* Let T be the execution time in milliseconds
* Then average time per operator = T/major usec
* (Because the inner loop has exactly 1000 operations)
*/
#define STOR_CL auto
#define TYPE short
#include
main(ac, av)
int ac;
char *av[];
{
STOR_CL TYPE a, b, c;
long d, major, atol();
static TYPE m[10] = {0};

major = atol(av[1]);
printf("executing %ld iterations\n", major);
a = b = (av[1][0] - '0');
for (d = 1; d <= major; ++d)
{
/* inner loop executes 1000 selected operations */
for (c = 1; c <= 40; ++c)
{
a = a + b + c;
b = a >> 1;
a = b % 10;
m[a] = a;
b = m[a] - b - c;
a = b == c;
b = a | c;
a = !b;
b = a + c;
a = b > c;
}
}
printf("a=%d\n", a);
}


  3 Responses to “Category : C Source Code
Archive   : PH_BENCH.ZIP
Filename : BENCHSHO.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/