xref: /illumos-gate/usr/src/cmd/msgfmt/gnu_prime.h (revision d48be21240dfd051b689384ce2b23479d757f2d8)
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 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 static const unsigned int	prime[] = {
35 	2,	3,	5,	7,	11,	/* 0 - 4 */
36 	13,	17,	19,	23,	29,	/* 5 - 9 */
37 	31,	37,	41,	43,	47,	/* 10 - 14 */
38 	53,	59,	61,	67,	71,	/* 15 - 19 */
39 	73,	79,	83,	89,	97,	/* 20 - 24 */
40 	101,	103,	107,	109,	113,	/* 25 - 29 */
41 	127,	131,	137,	139,	149,	/* 30 - 34 */
42 	151,	157,	163,	167,	173,	/* 35 - 39 */
43 	179,	181,	191,	193,	197,	/* 40 - 44 */
44 	199,	211,	223,	227,	229,	/* 45 - 49 */
45 	233,	239,	241,	251,	257,	/* 50 - 54 */
46 	263,	269,	271,	277,	281,	/* 55 - 59 */
47 	283,	293,	307,	311,	313,	/* 60 - 64 */
48 	317,	331,	337,	347,	349,	/* 65 - 69 */
49 	353,	359,	367,	373,	379,	/* 70 - 74 */
50 	383,	389,	397,	401,	409,	/* 75 - 79 */
51 	419,	421,	431,	433,	439,	/* 80 - 84 */
52 	443,	449,	457,	461,	463,	/* 85 - 89 */
53 	467,	479,	487,	491,	499,	/* 90 - 94 */
54 	503,	509,	521,	523,	541,	/* 95 - 99 */
55 	547,	557,	563,	569,	571,	/* 100 - 104 */
56 	577,	587,	593,	599,	601,	/* 105 - 109 */
57 	607,	613,	617,	619,	631,	/* 110 - 114 */
58 	641,	643,	647,	653,	659,	/* 115 - 119 */
59 	661,	673,	677,	683,	691,	/* 120 - 124 */
60 	701,	709,	719,	727,	733,	/* 125 - 129 */
61 	739,	743,	751,	757,	761,	/* 130 - 134 */
62 	769,	773,	787,	797,	809,	/* 135 - 139 */
63 	811,	821,	823,	827,	829,	/* 140 - 144 */
64 	839,	853,	857,	859,	863,	/* 145 - 149 */
65 	877,	881,	883,	887,	907,	/* 150 - 154 */
66 	911,	919,	929,	937,	941,	/* 155 - 159 */
67 	947,	953,	967,	971,	977,	/* 160 - 164 */
68 	983,	991,	997,	1009,	1013,	/* 165 - 169 */
69 	1019,	1021,	1031,	1033,	1039,	/* 170 - 174 */
70 	1049,	1051,	1061,	1063,	1069,	/* 175 - 179 */
71 	1087,	1091,	1093,	1097,	1103	/* 180 - 184 */
72 };
73 
74 static const int	index[] = {
75 	1,	/*    0:   3 */
76 	24,	/*  100:  97 */
77 	45,	/*  200: 199 */
78 	61,	/*  300: 293 */
79 	77,	/*  400: 397 */
80 	94,	/*  500: 499 */
81 	108,	/*  600: 599 */
82 	124,	/*  700: 691 */
83 	138,	/*  800: 797 */
84 	153,	/*  900: 887 */
85 	167	/* 1000: 997 */
86 };
87 
88 #define	MAX_INDEX_INDEX	10
89 #define	MAX_PRIME_INDEX	184
90 #define	START_SEARCH_INDEX	10	/* 31:  31 * 31 = 961 */
91 
92 #ifdef	__cplusplus
93 }
94 #endif
95 
96 #endif /* _GNU_PRIME_H */
97