OLD | NEW |
1 /* ------------------------------------------------------------------ */ | 1 /* ------------------------------------------------------------------ */ |
2 /* Decimal Number arithmetic module */ | 2 /* Decimal Number arithmetic module */ |
3 /* ------------------------------------------------------------------ */ | 3 /* ------------------------------------------------------------------ */ |
4 /* Copyright (c) IBM Corporation, 2000-2012. All rights reserved. */ | 4 /* Copyright (c) IBM Corporation, 2000-2014. All rights reserved. */ |
5 /* */ | 5 /* */ |
6 /* This software is made available under the terms of the */ | 6 /* This software is made available under the terms of the */ |
7 /* ICU License -- ICU 1.8.1 and later. */ | 7 /* ICU License -- ICU 1.8.1 and later. */ |
8 /* */ | 8 /* */ |
9 /* The description and User's Guide ("The decNumber C Library") for */ | 9 /* The description and User's Guide ("The decNumber C Library") for */ |
10 /* this software is called decNumber.pdf. This document is */ | 10 /* this software is called decNumber.pdf. This document is */ |
11 /* available, together with arithmetic and format specifications, */ | 11 /* available, together with arithmetic and format specifications, */ |
12 /* testcases, and Web links, on the General Decimal Arithmetic page. */ | 12 /* testcases, and Web links, on the General Decimal Arithmetic page. */ |
13 /* */ | 13 /* */ |
14 /* Please send comments, suggestions, and corrections to the author: */ | 14 /* Please send comments, suggestions, and corrections to the author: */ |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 #define BADINT (Int)0x80000000 /* most-negative Int; error indicator */ | 208 #define BADINT (Int)0x80000000 /* most-negative Int; error indicator */ |
209 /* Next two indicate an integer >= 10**6, and its parity (bottom bit) */ | 209 /* Next two indicate an integer >= 10**6, and its parity (bottom bit) */ |
210 #define BIGEVEN (Int)0x80000002 | 210 #define BIGEVEN (Int)0x80000002 |
211 #define BIGODD (Int)0x80000003 | 211 #define BIGODD (Int)0x80000003 |
212 | 212 |
213 static const Unit uarrone[1]={1}; /* Unit array of 1, used for incrementing *
/ | 213 static const Unit uarrone[1]={1}; /* Unit array of 1, used for incrementing *
/ |
214 | 214 |
215 /* ------------------------------------------------------------------ */ | 215 /* ------------------------------------------------------------------ */ |
216 /* round-for-reround digits */ | 216 /* round-for-reround digits */ |
217 /* ------------------------------------------------------------------ */ | 217 /* ------------------------------------------------------------------ */ |
| 218 #if 0 |
218 static const uByte DECSTICKYTAB[10]={1,1,2,3,4,6,6,7,8,9}; /* used if sticky */ | 219 static const uByte DECSTICKYTAB[10]={1,1,2,3,4,6,6,7,8,9}; /* used if sticky */ |
| 220 #endif |
219 | 221 |
220 /* ------------------------------------------------------------------ */ | 222 /* ------------------------------------------------------------------ */ |
221 /* Powers of ten (powers[n]==10**n, 0<=n<=9) */ | 223 /* Powers of ten (powers[n]==10**n, 0<=n<=9) */ |
222 /* ------------------------------------------------------------------ */ | 224 /* ------------------------------------------------------------------ */ |
223 static const uInt DECPOWERS[10]={1, 10, 100, 1000, 10000, 100000, 1000000, | 225 static const uInt DECPOWERS[10]={1, 10, 100, 1000, 10000, 100000, 1000000, |
224 10000000, 100000000, 1000000000}; | 226 10000000, 100000000, 1000000000}; |
225 | 227 |
226 | 228 |
227 /* Granularity-dependent code */ | 229 /* Granularity-dependent code */ |
228 #if DECDPUN<=4 | 230 #if DECDPUN<=4 |
(...skipping 7946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8175 for (b=b0+n+8; b<b0+n+12; b++) if (*b!=DECFENCE) | 8177 for (b=b0+n+8; b<b0+n+12; b++) if (*b!=DECFENCE) |
8176 printf("=== Corrupt byte [%02x] at offset +%d from %ld, n=%ld ===\n", *b, | 8178 printf("=== Corrupt byte [%02x] at offset +%d from %ld, n=%ld ===\n", *b, |
8177 b-b0-8, (LI)b0, (LI)n); | 8179 b-b0-8, (LI)b0, (LI)n); |
8178 free(b0); /* drop the storage */ | 8180 free(b0); /* drop the storage */ |
8179 decAllocBytes-=n; /* account for storage */ | 8181 decAllocBytes-=n; /* account for storage */ |
8180 /* printf(" free -- dAB: %d (%d)\n", decAllocBytes, -n); */ | 8182 /* printf(" free -- dAB: %d (%d)\n", decAllocBytes, -n); */ |
8181 } /* decFree */ | 8183 } /* decFree */ |
8182 #define malloc(a) decMalloc(a) | 8184 #define malloc(a) decMalloc(a) |
8183 #define free(a) decFree(a) | 8185 #define free(a) decFree(a) |
8184 #endif | 8186 #endif |
OLD | NEW |