X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Fprimetable.c;h=54f0fc8753580962ad7dd3626e593d96772f782d;hb=f6e91541c3d3818541f506d57d253f7d9afbeab3;hp=58ef62c9d58130ebbc795a509a42d15db940abd6;hpb=fa7aa6d9457616ce28f97c83eaa616d0ff276870;p=libucw.git diff --git a/ucw/primetable.c b/ucw/primetable.c index 58ef62c9..54f0fc87 100644 --- a/ucw/primetable.c +++ b/ucw/primetable.c @@ -12,7 +12,7 @@ #include /* A table of odd primes, each is about 1.2 times the previous one */ -static uns prime_table[] = { +static uint prime_table[] = { 3, 7, 13, @@ -122,8 +122,8 @@ static uns prime_table[] = { #define NPRIMES ARRAY_SIZE(prime_table) -uns -next_table_prime(uns x) +uint +next_table_prime(uint x) { if (x >= prime_table[NPRIMES-1]) return 0; @@ -131,8 +131,8 @@ next_table_prime(uns x) return prime_table[BIN_SEARCH_FIRST_GE(prime_table, NPRIMES, x+1)]; } -uns -prev_table_prime(uns x) +uint +prev_table_prime(uint x) { int i = BIN_SEARCH_FIRST_GE(prime_table, NPRIMES, x); return i ? prime_table[i-1] : 0; @@ -145,7 +145,7 @@ prev_table_prime(uns x) int main(void) { #if 0 /* Generate the table */ - uns x = 3, xx; + uint x = 3, xx; do { printf(" %u,\n", x); @@ -156,7 +156,7 @@ int main(void) #else for (int i=1; i<=100; i++) printf("%d\t%d\t%d\n", i, next_table_prime(i), prev_table_prime(i)); - for (uns i=0xfffffff0; i; i++) + for (uint i=0xfffffff0; i; i++) printf("%u\t%u\t%u\n", i, next_table_prime(i), prev_table_prime(i)); return 0; #endif