|
DataMuseum.dkPresents historical artifacts from the history of: CP/M |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about CP/M Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - download
Length: 1024 (0x400) Types: TextFile Names: »SIEVE.C«
└─⟦23f778bf6⟧ Bits:30005378 BDS C v1.46 & Pascal/MT+ v5.5 (Callan format) └─ ⟦this⟧ »SIEVE.C« └─⟦4ada80662⟧ Bits:30005446 Pascal/MT+ v5.5 & XREF & BDS C v1.46 └─ ⟦this⟧ »SIEVE.C«
/* Sieve of Eratosthenes benchmark from BYTE, Sep. '81, pg. 186. Compile by: A>cc1 sieve.c -e1000 All variables have been made external to speed them up; other than that one change, the program is identical to the one used in the BYTE benchmark....while they got an execution time of 49.5 seconds and a size of 3932 bytes using v1.32 of the compiler, ******** v1.45 clocks in at * 15.2 * seconds with a size of 3718 bytes! ******** */ #define TRUE 1 #define FALSE 0 #define SIZE 8190 #define SIZEPL 8191 char flagsÆSIZEPLÅ; int i,prime,k,count,iter; main() æ printf("Hit return to do 10 iterations: "); getchar(); for (iter = 1; iter <= 10; iter++) æ count = 0; for (i = 0; i <= SIZE; i++) flagsÆiÅ = TRUE; for (i = 0; i <= SIZE; i++) æ if (flagsÆiÅ) æ prime = i + i + 3; k = i + prime; while (k <= SIZE) æ flagsÆkÅ = FALSE; k += prime; å count++; å å å printf("Ø7Øn%d primes.Øn",count); å «eof»