diff options
author | Manish Singh <yosh@src.gnome.org> | 1998-09-02 07:44:02 +0000 |
---|---|---|
committer | Manish Singh <yosh@src.gnome.org> | 1998-09-02 07:44:02 +0000 |
commit | 7401460a60504dad7b77219d0ba3d93112e12444 (patch) | |
tree | fed3d898ae649a51d05038c18fa285b5cd4e66d7 /gprimes.c | |
parent | b420fa84187d9cb2f89ab8b3dd2040eab24742af (diff) |
Mostly changes to GArray code. See ChangeLog.
Diffstat (limited to 'gprimes.c')
-rw-r--r-- | gprimes.c | 23 |
1 files changed, 16 insertions, 7 deletions
@@ -18,14 +18,11 @@ */ #include "glib.h" - -gint g_primes[] = +static const guint g_primes[] = { 11, - 15, - 23, - 35, - 49, + 19, + 37, 73, 109, 163, @@ -59,4 +56,16 @@ gint g_primes[] = 13845163, }; -gint g_nprimes = sizeof (g_primes) / sizeof (g_primes[0]); +static const guint g_nprimes = sizeof (g_primes) / sizeof (g_primes[0]); + +guint +g_spaced_primes_closest (guint num) +{ + gint i; + + for (i = 0; i < g_nprimes; i++) + if (g_primes[i] > num) + return g_primes[i]; + + return g_primes[g_nprimes - 1]; +} |