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 /* */ 8 /* Copyright (c) IBM Corporation, 2000, 2005. All rights reserved. */ 9 /* */ 10 /* This software is made available under the terms of the ICU License. */ 11 /* */ 12 /* The description and User's Guide ("The decNumber C Library") for */ 13 /* this software is called decNumber.pdf. This document is available, */ 14 /* together with arithmetic and format specifications, testcases, and */ 15 /* 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 24 #if !defined(DECPACKED) 25 # define DECPACKED 26 # define DECPNAME "decPacked" /* Short name */ 27 # define DECPFULLNAME "Packed Decimal conversions" /* Verbose name */ 28 # define DECPAUTHOR "Mike Cowlishaw" /* Who to blame */ 29 30 # define DECPACKED_DefP 32 /* default precision */ 31 32 # if !defined(DECNUMDIGITS) 33 # define DECNUMDIGITS DECPACKED_DefP /* size if not already defined */ 34 # endif /* if !defined(DECNUMDIGITS) */ 35 # include "decNumber.h" /* context and number library */ 36 37 /* Sign nibble constants */ 38 # if !defined(DECPPLUSALT) 39 # define DECPPLUSALT 0x0A /* alternate plus nibble */ 40 # define DECPMINUSALT 0x0B /* alternate minus nibble */ 41 # define DECPPLUS 0x0C /* preferred plus nibble */ 42 # define DECPMINUS 0x0D /* preferred minus nibble */ 43 # define DECPPLUSALT2 0x0E /* alternate plus nibble */ 44 # define DECPUNSIGNED 0x0F /* alternate plus nibble (unsigned) */ 45 # endif /* if !defined(DECPPLUSALT) */ 46 47 /* ---------------------------------------------------------------- */ 48 /* decPacked public routines */ 49 /* ---------------------------------------------------------------- */ 50 /* Conversions */ 51 uint8_t * decPackedFromNumber(uint8_t *, int32_t, int32_t *, 52 const decNumber *); 53 decNumber * decPackedToNumber(const uint8_t *, int32_t, 54 const int32_t *, decNumber *); 55 #endif