decPacked.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* ------------------------------------------------------------------ */
  2. /* Packed Decimal conversion module header */
  3. /* ------------------------------------------------------------------ */
  4. /* Copyright (c) IBM Corporation, 2000, 2005. All rights reserved. */
  5. /* */
  6. /* This software is made available under the terms of the */
  7. /* ICU License -- ICU 1.8.1 and later. */
  8. /* */
  9. /* The description and User's Guide ("The decNumber C Library") for */
  10. /* this software is called decNumber.pdf. This document is */
  11. /* available, together with arithmetic and format specifications, */
  12. /* testcases, and Web links, on the General Decimal Arithmetic page. */
  13. /* */
  14. /* Please send comments, suggestions, and corrections to the author: */
  15. /* [email protected] */
  16. /* Mike Cowlishaw, IBM Fellow */
  17. /* IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK */
  18. /* ------------------------------------------------------------------ */
  19. #if !defined(DECPACKED)
  20. #define DECPACKED
  21. #define DECPNAME "decPacked" /* Short name */
  22. #define DECPFULLNAME "Packed Decimal conversions" /* Verbose name */
  23. #define DECPAUTHOR "Mike Cowlishaw" /* Who to blame */
  24. #define DECPACKED_DefP 32 /* default precision */
  25. #ifndef DECNUMDIGITS
  26. #define DECNUMDIGITS DECPACKED_DefP /* size if not already defined*/
  27. #endif
  28. #include "decNumber.h" /* context and number library */
  29. /* Sign nibble constants */
  30. #if !defined(DECPPLUSALT)
  31. #define DECPPLUSALT 0x0A /* alternate plus nibble */
  32. #define DECPMINUSALT 0x0B /* alternate minus nibble */
  33. #define DECPPLUS 0x0C /* preferred plus nibble */
  34. #define DECPMINUS 0x0D /* preferred minus nibble */
  35. #define DECPPLUSALT2 0x0E /* alternate plus nibble */
  36. #define DECPUNSIGNED 0x0F /* alternate plus nibble (unsigned) */
  37. #endif
  38. /* ---------------------------------------------------------------- */
  39. /* decPacked public routines */
  40. /* ---------------------------------------------------------------- */
  41. /* Conversions */
  42. uint8_t * decPackedFromNumber(uint8_t *, int32_t, int32_t *,
  43. const decNumber *);
  44. decNumber * decPackedToNumber(const uint8_t *, int32_t, const int32_t *,
  45. decNumber *);
  46. #endif