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