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