OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.misc-tests/] [sieve.c] - Rev 299

Compare with Previous | Blame | View Log

 
#define TRUE 1
#define FALSE 0
#define SIZE 8190
 
char flags[SIZE+1];
 
main()
{
	register int i, prime, k, count, iter;
	for (iter=1;iter<=100;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;
				for (k=i+prime;k<=SIZE;k+=prime)
					flags[k]=FALSE;
				count++;
			}
		}
	}
	return 0;
}
 
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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