xref: /dflybsd-src/contrib/gdtoa/hd_init.c (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
1*86d7f5d3SJohn Marino /****************************************************************
2*86d7f5d3SJohn Marino 
3*86d7f5d3SJohn Marino The author of this software is David M. Gay.
4*86d7f5d3SJohn Marino 
5*86d7f5d3SJohn Marino Copyright (C) 2000 by Lucent Technologies
6*86d7f5d3SJohn Marino All Rights Reserved
7*86d7f5d3SJohn Marino 
8*86d7f5d3SJohn Marino Permission to use, copy, modify, and distribute this software and
9*86d7f5d3SJohn Marino its documentation for any purpose and without fee is hereby
10*86d7f5d3SJohn Marino granted, provided that the above copyright notice appear in all
11*86d7f5d3SJohn Marino copies and that both that the copyright notice and this
12*86d7f5d3SJohn Marino permission notice and warranty disclaimer appear in supporting
13*86d7f5d3SJohn Marino documentation, and that the name of Lucent or any of its entities
14*86d7f5d3SJohn Marino not be used in advertising or publicity pertaining to
15*86d7f5d3SJohn Marino distribution of the software without specific, written prior
16*86d7f5d3SJohn Marino permission.
17*86d7f5d3SJohn Marino 
18*86d7f5d3SJohn Marino LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
19*86d7f5d3SJohn Marino INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
20*86d7f5d3SJohn Marino IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
21*86d7f5d3SJohn Marino SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
22*86d7f5d3SJohn Marino WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
23*86d7f5d3SJohn Marino IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
24*86d7f5d3SJohn Marino ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
25*86d7f5d3SJohn Marino THIS SOFTWARE.
26*86d7f5d3SJohn Marino 
27*86d7f5d3SJohn Marino ****************************************************************/
28*86d7f5d3SJohn Marino 
29*86d7f5d3SJohn Marino /* Please send bug reports to David M. Gay (dmg at acm dot org,
30*86d7f5d3SJohn Marino  * with " at " changed at "@" and " dot " changed to ".").	*/
31*86d7f5d3SJohn Marino 
32*86d7f5d3SJohn Marino #include "gdtoaimp.h"
33*86d7f5d3SJohn Marino 
34*86d7f5d3SJohn Marino  unsigned char hexdig[256];
35*86d7f5d3SJohn Marino 
36*86d7f5d3SJohn Marino  static void
37*86d7f5d3SJohn Marino #ifdef KR_headers
htinit(h,s,inc)38*86d7f5d3SJohn Marino htinit(h, s, inc) unsigned char *h; unsigned char *s; int inc;
39*86d7f5d3SJohn Marino #else
40*86d7f5d3SJohn Marino htinit(unsigned char *h, unsigned char *s, int inc)
41*86d7f5d3SJohn Marino #endif
42*86d7f5d3SJohn Marino {
43*86d7f5d3SJohn Marino 	int i, j;
44*86d7f5d3SJohn Marino 	for(i = 0; (j = s[i]) !=0; i++)
45*86d7f5d3SJohn Marino 		h[j] = i + inc;
46*86d7f5d3SJohn Marino 	}
47*86d7f5d3SJohn Marino 
48*86d7f5d3SJohn Marino  void
hexdig_init_D2A(Void)49*86d7f5d3SJohn Marino hexdig_init_D2A(Void)
50*86d7f5d3SJohn Marino {
51*86d7f5d3SJohn Marino #define USC (unsigned char *)
52*86d7f5d3SJohn Marino 	htinit(hexdig, USC "0123456789", 0x10);
53*86d7f5d3SJohn Marino 	htinit(hexdig, USC "abcdef", 0x10 + 10);
54*86d7f5d3SJohn Marino 	htinit(hexdig, USC "ABCDEF", 0x10 + 10);
55*86d7f5d3SJohn Marino 	}
56