OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.misc-tests/] [sieve.c] - Blame information for rev 154

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
 
2
#define TRUE 1
3
#define FALSE 0
4
#define SIZE 8190
5
 
6
char flags[SIZE+1];
7
 
8
main()
9
{
10
        register int i, prime, k, count, iter;
11
        for (iter=1;iter<=100;iter++)           {
12
                count=0;
13
                for (i=0;i<=SIZE;i++)
14
                        flags[i]=TRUE;
15
                for (i=0;i<=SIZE;i++) {
16
                        if (flags[i]) {
17
                                prime=i+i+3;
18
                                for (k=i+prime;k<=SIZE;k+=prime)
19
                                        flags[k]=FALSE;
20
                                count++;
21
                        }
22
                }
23
        }
24
        return 0;
25
}
26
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.