]> git.sur5r.net Git - cc65/blobdiff - samples/sieve.c
Fixed a bug: The floppies do not like ,R (for read mode) when opening the
[cc65] / samples / sieve.c
index b2fc9cdbc7eef5e3fedd327579e7cdf84a8e15dc..a82e972c9d1620a6578ea91b8b380784e3bb2968 100644 (file)
 #include <conio.h>
 
 
+/* Workaround missing clock stuff */
+#if defined(__APPLE2__) || defined(__APPLE2ENH__)
+#  define clock()              0
+#  define CLOCKS_PER_SEC       1
+#endif
+
+
 
 /*****************************************************************************/
 /*                                          Data                                    */
@@ -18,8 +25,8 @@
 
 
 
-#define COUNT          8192            /* Up to what number? */
-#define SQRT_COUNT     91              /* Sqrt of COUNT */
+#define COUNT          16384           /* Up to what number? */
+#define SQRT_COUNT     128             /* Sqrt of COUNT */
 
 static unsigned char Sieve[COUNT];
 
@@ -31,7 +38,7 @@ static unsigned char Sieve[COUNT];
 
 
 
-#pragma staticlocals(1);
+#pragma static-locals(1);
 
 
 
@@ -68,7 +75,8 @@ int main (void)
     while (I < SQRT_COUNT) {
        if (Sieve[I] == 0) {
            /* Prime number - mark multiples */
-           S = &Sieve[J = I*2];
+            J = I*2;
+           S = &Sieve[J];
                    while (J < COUNT) {
                *S = 1;
                S += I;