1/* GLIB - Library of useful routines for C programming 2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the 16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 * Boston, MA 02111-1307, USA. 18 */ 19 20/* 21 * Modified by the GLib Team and others 1997-2000. See the AUTHORS 22 * file for a list of people on the GLib Team. See the ChangeLog 23 * files for a list of changes. These files are distributed with 24 * GLib at ftp://ftp.gtk.org/pub/gtk/. 25 */ 26 27/* 28 * Modified by Bruno Haible for use as a gnulib module. 29 */ 30 31/* 32 * MT safe 33 */ 34 35#include "config.h" 36 37#include "glib.h" 38#if 0 39#include "galias.h" 40#endif 41 42 43static const guint g_primes[] = 44{ 45 11, 46 19, 47 37, 48 73, 49 109, 50 163, 51 251, 52 367, 53 557, 54 823, 55 1237, 56 1861, 57 2777, 58 4177, 59 6247, 60 9371, 61 14057, 62 21089, 63 31627, 64 47431, 65 71143, 66 106721, 67 160073, 68 240101, 69 360163, 70 540217, 71 810343, 72 1215497, 73 1823231, 74 2734867, 75 4102283, 76 6153409, 77 9230113, 78 13845163, 79}; 80 81static const guint g_nprimes = sizeof (g_primes) / sizeof (g_primes[0]); 82 83guint 84g_spaced_primes_closest (guint num) 85{ 86 gint i; 87 88 for (i = 0; i < g_nprimes; i++) 89 if (g_primes[i] > num) 90 return g_primes[i]; 91 92 return g_primes[g_nprimes - 1]; 93} 94 95#if 0 96#define __G_PRIMES_C__ 97#include "galiasdef.c" 98#endif 99