1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 2001-2002 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _GNU_PRIME_H 28*0Sstevel@tonic-gate #define _GNU_PRIME_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate #ifdef __cplusplus 33*0Sstevel@tonic-gate extern "C" { 34*0Sstevel@tonic-gate #endif 35*0Sstevel@tonic-gate 36*0Sstevel@tonic-gate static const unsigned int prime[] = { 37*0Sstevel@tonic-gate 2, 3, 5, 7, 11, /* 0 - 4 */ 38*0Sstevel@tonic-gate 13, 17, 19, 23, 29, /* 5 - 9 */ 39*0Sstevel@tonic-gate 31, 37, 41, 43, 47, /* 10 - 14 */ 40*0Sstevel@tonic-gate 53, 59, 61, 67, 71, /* 15 - 19 */ 41*0Sstevel@tonic-gate 73, 79, 83, 89, 97, /* 20 - 24 */ 42*0Sstevel@tonic-gate 101, 103, 107, 109, 113, /* 25 - 29 */ 43*0Sstevel@tonic-gate 127, 131, 137, 139, 149, /* 30 - 34 */ 44*0Sstevel@tonic-gate 151, 157, 163, 167, 173, /* 35 - 39 */ 45*0Sstevel@tonic-gate 179, 181, 191, 193, 197, /* 40 - 44 */ 46*0Sstevel@tonic-gate 199, 211, 223, 227, 229, /* 45 - 49 */ 47*0Sstevel@tonic-gate 233, 239, 241, 251, 257, /* 50 - 54 */ 48*0Sstevel@tonic-gate 263, 269, 271, 277, 281, /* 55 - 59 */ 49*0Sstevel@tonic-gate 283, 293, 307, 311, 313, /* 60 - 64 */ 50*0Sstevel@tonic-gate 317, 331, 337, 347, 349, /* 65 - 69 */ 51*0Sstevel@tonic-gate 353, 359, 367, 373, 379, /* 70 - 74 */ 52*0Sstevel@tonic-gate 383, 389, 397, 401, 409, /* 75 - 79 */ 53*0Sstevel@tonic-gate 419, 421, 431, 433, 439, /* 80 - 84 */ 54*0Sstevel@tonic-gate 443, 449, 457, 461, 463, /* 85 - 89 */ 55*0Sstevel@tonic-gate 467, 479, 487, 491, 499, /* 90 - 94 */ 56*0Sstevel@tonic-gate 503, 509, 521, 523, 541, /* 95 - 99 */ 57*0Sstevel@tonic-gate 547, 557, 563, 569, 571, /* 100 - 104 */ 58*0Sstevel@tonic-gate 577, 587, 593, 599, 601, /* 105 - 109 */ 59*0Sstevel@tonic-gate 607, 613, 617, 619, 631, /* 110 - 114 */ 60*0Sstevel@tonic-gate 641, 643, 647, 653, 659, /* 115 - 119 */ 61*0Sstevel@tonic-gate 661, 673, 677, 683, 691, /* 120 - 124 */ 62*0Sstevel@tonic-gate 701, 709, 719, 727, 733, /* 125 - 129 */ 63*0Sstevel@tonic-gate 739, 743, 751, 757, 761, /* 130 - 134 */ 64*0Sstevel@tonic-gate 769, 773, 787, 797, 809, /* 135 - 139 */ 65*0Sstevel@tonic-gate 811, 821, 823, 827, 829, /* 140 - 144 */ 66*0Sstevel@tonic-gate 839, 853, 857, 859, 863, /* 145 - 149 */ 67*0Sstevel@tonic-gate 877, 881, 883, 887, 907, /* 150 - 154 */ 68*0Sstevel@tonic-gate 911, 919, 929, 937, 941, /* 155 - 159 */ 69*0Sstevel@tonic-gate 947, 953, 967, 971, 977, /* 160 - 164 */ 70*0Sstevel@tonic-gate 983, 991, 997, 1009, 1013, /* 165 - 169 */ 71*0Sstevel@tonic-gate 1019, 1021, 1031, 1033, 1039, /* 170 - 174 */ 72*0Sstevel@tonic-gate 1049, 1051, 1061, 1063, 1069, /* 175 - 179 */ 73*0Sstevel@tonic-gate 1087, 1091, 1093, 1097, 1103 /* 180 - 184 */ 74*0Sstevel@tonic-gate }; 75*0Sstevel@tonic-gate 76*0Sstevel@tonic-gate static const int index[] = { 77*0Sstevel@tonic-gate 1, /* 0: 3 */ 78*0Sstevel@tonic-gate 24, /* 100: 97 */ 79*0Sstevel@tonic-gate 45, /* 200: 199 */ 80*0Sstevel@tonic-gate 61, /* 300: 293 */ 81*0Sstevel@tonic-gate 77, /* 400: 397 */ 82*0Sstevel@tonic-gate 94, /* 500: 499 */ 83*0Sstevel@tonic-gate 108, /* 600: 599 */ 84*0Sstevel@tonic-gate 124, /* 700: 691 */ 85*0Sstevel@tonic-gate 138, /* 800: 797 */ 86*0Sstevel@tonic-gate 153, /* 900: 887 */ 87*0Sstevel@tonic-gate 167 /* 1000: 997 */ 88*0Sstevel@tonic-gate }; 89*0Sstevel@tonic-gate 90*0Sstevel@tonic-gate #define MAX_INDEX_INDEX 10 91*0Sstevel@tonic-gate #define MAX_PRIME_INDEX 184 92*0Sstevel@tonic-gate #define START_SEARCH_INDEX 10 /* 31: 31 * 31 = 961 */ 93*0Sstevel@tonic-gate 94*0Sstevel@tonic-gate #ifdef __cplusplus 95*0Sstevel@tonic-gate } 96*0Sstevel@tonic-gate #endif 97*0Sstevel@tonic-gate 98*0Sstevel@tonic-gate #endif /* _GNU_PRIME_H */ 99