hd_init.c 1.8 KB

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