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 (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24 * Use is subject to license terms.
25 */
26
27#pragma ident	"%Z%%M%	%I%	%E% SMI"
28
29#include "lint.h"
30#include <sys/types.h>
31
32/* table of 64 multiples of 10**1 */
33const unsigned short __tbl_10_small_digits [] = { 1,
34/* 10**1 = */
355 /* h    1 */,
36/* 10**2 = */
3725 /* h    2 */,
38/* 10**3 = */
39125 /* h    3 */,
40/* 10**4 = */
41625 /* h    4 */,
42/* 10**5 = */
433125 /* h    5 */,
44/* 10**6 = */
4515625 /* h    6 */,
46/* 10**7 = */
4712589 /* h    7 */, 1 /* h   23 */,
48/* 10**8 = */
4962945 /* h    8 */, 5 /* h   24 */,
50/* 10**9 = */
5152581 /* h    9 */, 29 /* h   25 */,
52/* 10**10 = */
53761 /* h   10 */, 149 /* h   26 */,
54/* 10**11 = */
553805 /* h   11 */, 745 /* h   27 */,
56/* 10**12 = */
5719025 /* h   12 */, 3725 /* h   28 */,
58/* 10**13 = */
5929589 /* h   13 */, 18626 /* h   29 */,
60/* 10**14 = */
6116873 /* h   14 */, 27596 /* h   30 */, 1 /* h   46 */,
62/* 10**15 = */
6318829 /* h   15 */, 6909 /* h   31 */, 7 /* h   47 */,
64/* 10**16 = */
6528609 /* h   16 */, 34546 /* h   32 */, 35 /* h   48 */,
66/* 10**17 = */
6711973 /* h   17 */, 41660 /* h   33 */, 177 /* h   49 */,
68/* 10**18 = */
6959865 /* h   18 */, 11692 /* h   34 */, 888 /* h   50 */,
70/* 10**19 = */
7137181 /* h   19 */, 58464 /* h   35 */, 4440 /* h   51 */,
72/* 10**20 = */
7354833 /* h   20 */, 30178 /* h   36 */, 22204 /* h   52 */,
74/* 10**21 = */
7512021 /* h   21 */, 19822 /* h   37 */, 45486 /* h   53 */, 1 /* h   69 */,
76
77/* 10**22 = */
7860105 /* h   22 */, 33574 /* h   38 */, 30823 /* h   54 */, 8 /* h   70 */,
79
80/* 10**23 = */
8138381 /* h   23 */, 36802 /* h   39 */, 23045 /* h   55 */, 42 /* h   71 */,
82
83/* 10**24 = */
8460833 /* h   24 */, 52940 /* h   40 */, 49691 /* h   56 */, 211 /* h   72 */,
85
86/* 10**25 = */
8742021 /* h   25 */, 2560 /* h   41 */, 51851 /* h   57 */, 1058 /* h   73 */,
88
89/* 10**26 = */
9013497 /* h   26 */, 12803 /* h   42 */, 62647 /* h   58 */, 5293 /* h   74 */,
91
92/* 10**27 = */
931949 /* h   27 */, 64016 /* h   43 */, 51091 /* h   59 */, 26469 /* h   75 */,
94
95/* 10**28 = */
969745 /* h   28 */, 57936 /* h   44 */, 58851 /* h   60 */, 1276 /* h   76 */,
972 /* h   92 */,
98/* 10**29 = */
9948725 /* h   29 */, 27536 /* h   45 */, 32115 /* h   61 */, 6384 /* h   77 */,
10010 /* h   93 */,
101/* 10**30 = */
10247017 /* h   30 */, 6611 /* h   46 */, 29505 /* h   62 */, 31922 /* h   78 */,
10350 /* h   94 */,
104/* 10**31 = */
10538477 /* h   31 */, 33058 /* h   47 */, 16453 /* h   63 */, 28540 /* h   79 */,
106252 /* h   95 */,
107/* 10**32 = */
10861313 /* h   32 */, 34220 /* h   48 */, 16731 /* h   64 */, 11629 /* h   80 */,
1091262 /* h   96 */,
110/* 10**33 = */
11144421 /* h   33 */, 40032 /* h   49 */, 18121 /* h   65 */, 58146 /* h   81 */,
1126310 /* h   97 */,
113/* 10**34 = */
11425497 /* h   34 */, 3555 /* h   50 */, 25072 /* h   66 */, 28587 /* h   82 */,
11531554 /* h   98 */,
116/* 10**35 = */
11761949 /* h   35 */, 17776 /* h   51 */, 59824 /* h   67 */, 11864 /* h   83 */,
11826700 /* h   99 */, 2 /* h  115 */,
119/* 10**36 = */
12047601 /* h   36 */, 23348 /* h   52 */, 36977 /* h   68 */, 59324 /* h   84 */,
1212428 /* h  100 */, 12 /* h  116 */,
122/* 10**37 = */
12341397 /* h   37 */, 51207 /* h   53 */, 53814 /* h   69 */, 34478 /* h   85 */,
12412144 /* h  101 */, 60 /* h  117 */,
125/* 10**38 = */
12610377 /* h   38 */, 59430 /* h   54 */, 6929 /* h   70 */, 41322 /* h   86 */,
12760722 /* h  102 */, 300 /* h  118 */,
128/* 10**39 = */
12951885 /* h   39 */, 35006 /* h   55 */, 34649 /* h   71 */, 10002 /* h   87 */,
13041469 /* h  103 */, 1504 /* h  119 */,
131/* 10**40 = */
13262817 /* h   40 */, 43961 /* h   56 */, 42175 /* h   72 */, 50012 /* h   88 */,
13310737 /* h  104 */, 7523 /* h  120 */,
134/* 10**41 = */
13551941 /* h   41 */, 23201 /* h   57 */, 14270 /* h   73 */, 53455 /* h   89 */,
13653688 /* h  105 */, 37615 /* h  121 */,
137/* 10**42 = */
13863097 /* h   42 */, 50472 /* h   58 */, 5815 /* h   74 */, 5132 /* h   90 */,
1396300 /* h  106 */, 57007 /* h  122 */, 2 /* h  138 */,
140/* 10**43 = */
14153341 /* h   43 */, 55756 /* h   59 */, 29078 /* h   75 */, 25660 /* h   91 */,
14231500 /* h  107 */, 22891 /* h  123 */, 14 /* h  139 */,
143/* 10**44 = */
1444561 /* h   44 */, 16640 /* h   60 */, 14322 /* h   76 */, 62766 /* h   92 */,
14526429 /* h  108 */, 48921 /* h  124 */, 71 /* h  140 */,
146/* 10**45 = */
14722805 /* h   45 */, 17664 /* h   61 */, 6075 /* h   77 */, 51687 /* h   93 */,
1481077 /* h  109 */, 47999 /* h  125 */, 358 /* h  141 */,
149/* 10**46 = */
15048489 /* h   46 */, 22785 /* h   62 */, 30376 /* h   78 */, 61827 /* h   94 */,
1515388 /* h  110 */, 43387 /* h  126 */, 1793 /* h  142 */,
152/* 10**47 = */
15345837 /* h   47 */, 48392 /* h   63 */, 20809 /* h   79 */, 46993 /* h   95 */,
15426944 /* h  111 */, 20327 /* h  127 */, 8968 /* h  143 */,
155/* 10**48 = */
15632577 /* h   48 */, 45355 /* h   64 */, 38512 /* h   80 */, 38358 /* h   96 */,
1573651 /* h  112 */, 36101 /* h  128 */, 44841 /* h  144 */,
158/* 10**49 = */
15931813 /* h   49 */, 30169 /* h   65 */, 61491 /* h   81 */, 60720 /* h   97 */,
16018257 /* h  113 */, 49433 /* h  129 */, 27599 /* h  145 */, 3 /* h  161 */,
161
162/* 10**50 = */
16327993 /* h   50 */, 19775 /* h   66 */, 45313 /* h   82 */, 41460 /* h   98 */,
16425753 /* h  114 */, 50558 /* h  130 */, 6926 /* h  146 */, 17 /* h  162 */,
165
166/* 10**51 = */
1678893 /* h   51 */, 33341 /* h   67 */, 29958 /* h   83 */, 10695 /* h   99 */,
16863232 /* h  115 */, 56183 /* h  131 */, 34633 /* h  147 */, 85 /* h  163 */,
169
170/* 10**52 = */
17144465 /* h   52 */, 35633 /* h   68 */, 18720 /* h   84 */, 53477 /* h  100 */,
17254016 /* h  116 */, 18775 /* h  132 */, 42097 /* h  148 */, 427 /* h  164 */,
173
174/* 10**53 = */
17525717 /* h   53 */, 47096 /* h   69 */, 28066 /* h   85 */, 5242 /* h  101 */,
1767940 /* h  117 */, 28343 /* h  133 */, 13878 /* h  149 */, 2138 /* h  165 */,
177
178/* 10**54 = */
17963049 /* h   54 */, 38873 /* h   70 */, 9261 /* h   86 */, 26212 /* h  102 */,
18039700 /* h  118 */, 10643 /* h  134 */, 3856 /* h  150 */, 10691 /* h  166 */,
181
182/* 10**55 = */
18353101 /* h   55 */, 63297 /* h   71 */, 46307 /* h   87 */, 65524 /* h  103 */,
1841893 /* h  119 */, 53218 /* h  135 */, 19280 /* h  151 */, 53455 /* h  167 */,
185
186/* 10**56 = */
1873361 /* h   56 */, 54345 /* h   72 */, 34931 /* h   88 */, 65479 /* h  104 */,
1889469 /* h  120 */, 3946 /* h  136 */, 30868 /* h  152 */, 5132 /* h  168 */,
1894 /* h  184 */,
190/* 10**57 = */
19116805 /* h   57 */, 9581 /* h   73 */, 43587 /* h   89 */, 65253 /* h  105 */,
19247349 /* h  121 */, 19730 /* h  137 */, 23268 /* h  153 */, 25662 /* h  169 */,
19320 /* h  185 */,
194/* 10**58 = */
19518489 /* h   58 */, 47906 /* h   74 */, 21327 /* h   90 */, 64124 /* h  106 */,
19640141 /* h  122 */, 33117 /* h  138 */, 50805 /* h  154 */, 62775 /* h  170 */,
197101 /* h  186 */,
198/* 10**59 = */
19926909 /* h   59 */, 42923 /* h   75 */, 41102 /* h   91 */, 58477 /* h  107 */,
2004101 /* h  123 */, 34516 /* h  139 */, 57419 /* h  155 */, 51734 /* h  171 */,
201509 /* h  187 */,
202/* 10**60 = */
2033473 /* h   60 */, 18009 /* h   76 */, 8905 /* h   92 */, 30244 /* h  108 */,
20420509 /* h  124 */, 41508 /* h  140 */, 24953 /* h  156 */, 62066 /* h  172 */,
2052548 /* h  188 */,
206/* 10**61 = */
20717365 /* h   61 */, 24509 /* h   77 */, 44526 /* h   93 */, 20148 /* h  109 */,
20837011 /* h  125 */, 10933 /* h  141 */, 59232 /* h  157 */, 48187 /* h  173 */,
20912744 /* h  189 */,
210/* 10**62 = */
21121289 /* h   62 */, 57010 /* h   78 */, 26023 /* h   94 */, 35207 /* h  110 */,
21253984 /* h  126 */, 54667 /* h  142 */, 34016 /* h  158 */, 44331 /* h  174 */,
21363723 /* h  190 */,
214/* 10**63 = */
21540909 /* h   63 */, 22907 /* h   79 */, 64583 /* h   95 */, 44964 /* h  111 */,
2167778 /* h  127 */, 11195 /* h  143 */, 39012 /* h  159 */, 25049 /* h  175 */,
21756474 /* h  191 */, 4 /* h  207 */,
2180};
219
220/* table of starting indexes into previous table */
221const unsigned short __tbl_10_small_start [] = {
2220, 1, 2, 3, 4, 5, 6, 7,
2239, 11, 13, 15, 17, 19, 21, 24,
22427, 30, 33, 36, 39, 42, 46, 50,
22554, 58, 62, 66, 70, 75, 80, 85,
22690, 95, 100, 105, 111, 117, 123, 129,
227135, 141, 147, 154, 161, 168, 175, 182,
228189, 196, 204, 212, 220, 228, 236, 244,
229252, 261, 270, 279, 288, 297, 306, 315,
230325, 0};
231