summaryrefslogtreecommitdiff
path: root/gprimes.c
diff options
context:
space:
mode:
authorManish Singh <yosh@src.gnome.org>1998-09-02 07:44:02 +0000
committerManish Singh <yosh@src.gnome.org>1998-09-02 07:44:02 +0000
commit7401460a60504dad7b77219d0ba3d93112e12444 (patch)
treefed3d898ae649a51d05038c18fa285b5cd4e66d7 /gprimes.c
parentb420fa84187d9cb2f89ab8b3dd2040eab24742af (diff)
Mostly changes to GArray code. See ChangeLog.
Diffstat (limited to 'gprimes.c')
-rw-r--r--gprimes.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/gprimes.c b/gprimes.c
index 6a38b399d..3d45c1ef7 100644
--- a/gprimes.c
+++ b/gprimes.c
@@ -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];
+}