summaryrefslogtreecommitdiff
path: root/libdecnumber/decDPD.h
blob: 40ff37a6ec0a5aa0677339bf2b13275be5ed5f8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
/* Binary Coded Decimal <--> Densely Packed Decimal lookup tables.
   Copyright (C) 2005 Free Software Foundation, Inc.
   Contributed by IBM Corporation.  Author Mike Cowlishaw.

   This file is part of GCC.

   GCC is free software; you can redistribute it and/or modify it under
   the terms of the GNU General Public License as published by the Free
   Software Foundation; either version 2, or (at your option) any later
   version.

   GCC is distributed in the hope that it will be useful, but WITHOUT ANY
   WARRANTY; without even the implied warranty of MERCHANTABILITY or
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   for more details.

   You should have received a copy of the GNU General Public License
   along with GCC; see the file COPYING.  If not, write to the Free
   Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
   02110-1301, USA.  */

/* ------------------------------------------------------------------------ */
/* For details, see: http://www2.hursley.ibm.com/decimal/DPDecimal.html     */
/*                                                                          */
/* This include file defines conversion tables for DPD, as follows.         */
/*                                                                          */
/*   uint16_t BCD2DPD[2458];     // BCD -> DPD (0x999 => 2457)              */
/*   uint16_t DPD2BCD[1024];     // DPD -> BCD (0x3FF => 0x999)             */
/*   uint16_t BIN2DPD[1000];     // BIN -> DPD (999 => 2457)                */
/*   uint16_t DPD2BIN[1024];     // DPD -> BIN (0x3FF => 999)               */
/*                                                                          */
/* In all cases the result (10 bits or 12 bits, or binary) is right-aligned */
/* in the table entry.                                                      */
/*                                                                          */
/* To use a table, its name, prefixed with DEC_, must be defined with a     */
/* value of 1 before this header file is included.  For example:            */
/*    #define DEC_BCD2DPD 1                                                 */
/* ------------------------------------------------------------------------ */

#if DEC_BCD2DPD==1

const uint16_t BCD2DPD[2458] = { 0, 1, 2, 3, 4, 5, 6, 7,
  8, 9, 0, 0, 0, 0, 0, 0, 16, 17, 18, 19, 20,
  21, 22, 23, 24, 25, 0, 0, 0, 0, 0, 0, 32, 33,
  34, 35, 36, 37, 38, 39, 40, 41, 0, 0, 0, 0, 0,
  0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 0, 0,
  0, 0, 0, 0, 64, 65, 66, 67, 68, 69, 70, 71, 72,
  73, 0, 0, 0, 0, 0, 0, 80, 81, 82, 83, 84, 85,
  86, 87, 88, 89, 0, 0, 0, 0, 0, 0, 96, 97, 98,
  99, 100, 101, 102, 103, 104, 105, 0, 0, 0, 0, 0, 0,
  112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 0, 0, 0,
  0, 0, 0, 10, 11, 42, 43, 74, 75, 106, 107, 78, 79,
  0, 0, 0, 0, 0, 0, 26, 27, 58, 59, 90, 91, 122,
  123, 94, 95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 10, 11, 42, 43, 74,
  75, 106, 107, 78, 79, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 0, 0,
  0, 0, 0, 0, 144, 145, 146, 147, 148, 149, 150, 151, 152,
  153, 0, 0, 0, 0, 0, 0, 160, 161, 162, 163, 164, 165,
  166, 167, 168, 169, 0, 0, 0, 0, 0, 0, 176, 177, 178,
  179, 180, 181, 182, 183, 184, 185, 0, 0, 0, 0, 0, 0,
  192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 0, 0, 0,
  0, 0, 0, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217,
  0, 0, 0, 0, 0, 0, 224, 225, 226, 227, 228, 229, 230,
  231, 232, 233, 0, 0, 0, 0, 0, 0, 240, 241, 242, 243,
  244, 245, 246, 247, 248, 249, 0, 0, 0, 0, 0, 0, 138,
  139, 170, 171, 202, 203, 234, 235, 206, 207, 0, 0, 0, 0,
  0, 0, 154, 155, 186, 187, 218, 219, 250, 251, 222, 223, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 138, 139, 170, 171, 202, 203, 234, 235, 206,
  207, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 256, 257, 258,
  259, 260, 261, 262, 263, 264, 265, 0, 0, 0, 0, 0, 0,
  272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 0, 0, 0,
  0, 0, 0, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297,
  0, 0, 0, 0, 0, 0, 304, 305, 306, 307, 308, 309, 310,
  311, 312, 313, 0, 0, 0, 0, 0, 0, 320, 321, 322, 323,
  324, 325, 326, 327, 328, 329, 0, 0, 0, 0, 0, 0, 336,
  337, 338, 339, 340, 341, 342, 343, 344, 345, 0, 0, 0, 0,
  0, 0, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 0,
  0, 0, 0, 0, 0, 368, 369, 370, 371, 372, 373, 374, 375,
  376, 377, 0, 0, 0, 0, 0, 0, 266, 267, 298, 299, 330,
  331, 362, 363, 334, 335, 0, 0, 0, 0, 0, 0, 282, 283,
  314, 315, 346, 347, 378, 379, 350, 351, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  266, 267, 298, 299, 330, 331, 362, 363, 334, 335, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 384, 385, 386, 387, 388, 389, 390,
  391, 392, 393, 0, 0, 0, 0, 0, 0, 400, 401, 402, 403,
  404, 405, 406, 407, 408, 409, 0, 0, 0, 0, 0, 0, 416,
  417, 418, 419, 420, 421, 422, 423, 424, 425, 0, 0, 0, 0,
  0, 0, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 0,
  0, 0, 0, 0, 0, 448, 449, 450, 451, 452, 453, 454, 455,
  456, 457, 0, 0, 0, 0, 0, 0, 464, 465, 466, 467, 468,
  469, 470, 471, 472, 473, 0, 0, 0, 0, 0, 0, 480, 481,
  482, 483, 484, 485, 486, 487, 488, 489, 0, 0, 0, 0, 0,
  0, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 0, 0,
  0, 0, 0, 0, 394, 395, 426, 427, 458, 459, 490, 491, 462,
  463, 0, 0, 0, 0, 0, 0, 410, 411, 442, 443, 474, 475,
  506, 507, 478, 479, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 394, 395, 426, 427,
  458, 459, 490, 491, 462, 463, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 0,
  0, 0, 0, 0, 0, 528, 529, 530, 531, 532, 533, 534, 535,
  536, 537, 0, 0, 0, 0, 0, 0, 544, 545, 546, 547, 548,
  549, 550, 551, 552, 553, 0, 0, 0, 0, 0, 0, 560, 561,
  562, 563, 564, 565, 566, 567, 568, 569, 0, 0, 0, 0, 0,
  0, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 0, 0,
  0, 0, 0, 0, 592, 593, 594, 595, 596, 597, 598, 599, 600,
  601, 0, 0, 0, 0, 0, 0, 608, 609, 610, 611, 612, 613,
  614, 615, 616, 617, 0, 0, 0, 0, 0, 0, 624, 625, 626,
  627, 628, 629, 630, 631, 632, 633, 0, 0, 0, 0, 0, 0,
  522, 523, 554, 555, 586, 587, 618, 619, 590, 591, 0, 0, 0,
  0, 0, 0, 538, 539, 570, 571, 602, 603, 634, 635, 606, 607,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 522, 523, 554, 555, 586, 587, 618, 619,
  590, 591, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 640, 641,
  642, 643, 644, 645, 646, 647, 648, 649, 0, 0, 0, 0, 0,
  0, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 0, 0,
  0, 0, 0, 0, 672, 673, 674, 675, 676, 677, 678, 679, 680,
  681, 0, 0, 0, 0, 0, 0, 688, 689, 690, 691, 692, 693,
  694, 695, 696, 697, 0, 0, 0, 0, 0, 0, 704, 705, 706,
  707, 708, 709, 710, 711, 712, 713, 0, 0, 0, 0, 0, 0,
  720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 0, 0, 0,
  0, 0, 0, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745,
  0, 0, 0, 0, 0, 0, 752, 753, 754, 755, 756, 757, 758,
  759, 760, 761, 0, 0, 0, 0, 0, 0, 650, 651, 682, 683,
  714, 715, 746, 747, 718, 719, 0, 0, 0, 0, 0, 0, 666,
  667, 698, 699, 730, 731, 762, 763, 734, 735, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 650, 651, 682, 683, 714, 715, 746, 747, 718, 719, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 768, 769, 770, 771, 772, 773,
  774, 775, 776, 777, 0, 0, 0, 0, 0, 0, 784, 785, 786,
  787, 788, 789, 790, 791, 792, 793, 0, 0, 0, 0, 0, 0,
  800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 0, 0, 0,
  0, 0, 0, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825,
  0, 0, 0, 0, 0, 0, 832, 833, 834, 835, 836, 837, 838,
  839, 840, 841, 0, 0, 0, 0, 0, 0, 848, 849, 850, 851,
  852, 853, 854, 855, 856, 857, 0, 0, 0, 0, 0, 0, 864,
  865, 866, 867, 868, 869, 870, 871, 872, 873, 0, 0, 0, 0,
  0, 0, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 0,
  0, 0, 0, 0, 0, 778, 779, 810, 811, 842, 843, 874, 875,
  846, 847, 0, 0, 0, 0, 0, 0, 794, 795, 826, 827, 858,
  859, 890, 891, 862, 863, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 778, 779, 810,
  811, 842, 843, 874, 875, 846, 847, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905,
  0, 0, 0, 0, 0, 0, 912, 913, 914, 915, 916, 917, 918,
  919, 920, 921, 0, 0, 0, 0, 0, 0, 928, 929, 930, 931,
  932, 933, 934, 935, 936, 937, 0, 0, 0, 0, 0, 0, 944,
  945, 946, 947, 948, 949, 950, 951, 952, 953, 0, 0, 0, 0,
  0, 0, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 0,
  0, 0, 0, 0, 0, 976, 977, 978, 979, 980, 981, 982, 983,
  984, 985, 0, 0, 0, 0, 0, 0, 992, 993, 994, 995, 996,
  997, 998, 999, 1000, 1001, 0, 0, 0, 0, 0, 0, 1008, 1009,
  1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 0, 0, 0, 0, 0,
  0, 906, 907, 938, 939, 970, 971, 1002, 1003, 974, 975, 0, 0,
  0, 0, 0, 0, 922, 923, 954, 955, 986, 987, 1018, 1019, 990,
  991, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 906, 907, 938, 939, 970, 971, 1002,
  1003, 974, 975, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12,
  13, 268, 269, 524, 525, 780, 781, 46, 47, 0, 0, 0, 0,
  0, 0, 28, 29, 284, 285, 540, 541, 796, 797, 62, 63, 0,
  0, 0, 0, 0, 0, 44, 45, 300, 301, 556, 557, 812, 813,
  302, 303, 0, 0, 0, 0, 0, 0, 60, 61, 316, 317, 572,
  573, 828, 829, 318, 319, 0, 0, 0, 0, 0, 0, 76, 77,
  332, 333, 588, 589, 844, 845, 558, 559, 0, 0, 0, 0, 0,
  0, 92, 93, 348, 349, 604, 605, 860, 861, 574, 575, 0, 0,
  0, 0, 0, 0, 108, 109, 364, 365, 620, 621, 876, 877, 814,
  815, 0, 0, 0, 0, 0, 0, 124, 125, 380, 381, 636, 637,
  892, 893, 830, 831, 0, 0, 0, 0, 0, 0, 14, 15, 270,
  271, 526, 527, 782, 783, 110, 111, 0, 0, 0, 0, 0, 0,
  30, 31, 286, 287, 542, 543, 798, 799, 126, 127, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 14, 15, 270, 271, 526, 527, 782, 783, 110, 111, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 140, 141, 396, 397, 652,
  653, 908, 909, 174, 175, 0, 0, 0, 0, 0, 0, 156, 157,
  412, 413, 668, 669, 924, 925, 190, 191, 0, 0, 0, 0, 0,
  0, 172, 173, 428, 429, 684, 685, 940, 941, 430, 431, 0, 0,
  0, 0, 0, 0, 188, 189, 444, 445, 700, 701, 956, 957, 446,
  447, 0, 0, 0, 0, 0, 0, 204, 205, 460, 461, 716, 717,
  972, 973, 686, 687, 0, 0, 0, 0, 0, 0, 220, 221, 476,
  477, 732, 733, 988, 989, 702, 703, 0, 0, 0, 0, 0, 0,
  236, 237, 492, 493, 748, 749, 1004, 1005, 942, 943, 0, 0, 0,
  0, 0, 0, 252, 253, 508, 509, 764, 765, 1020, 1021, 958, 959,
  0, 0, 0, 0, 0, 0, 142, 143, 398, 399, 654, 655, 910,
  911, 238, 239, 0, 0, 0, 0, 0, 0, 158, 159, 414, 415,
  670, 671, 926, 927, 254, 255
};
#endif

#if DEC_DPD2BCD==1

const uint16_t DPD2BCD[1024] = { 0, 1, 2, 3, 4, 5, 6, 7,
  8, 9, 128, 129, 2048, 2049, 2176, 2177, 16, 17, 18, 19, 20,
  21, 22, 23, 24, 25, 144, 145, 2064, 2065, 2192, 2193, 32, 33,
  34, 35, 36, 37, 38, 39, 40, 41, 130, 131, 2080, 2081, 2056,
  2057, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 146, 147,
  2096, 2097, 2072, 2073, 64, 65, 66, 67, 68, 69, 70, 71, 72,
  73, 132, 133, 2112, 2113, 136, 137, 80, 81, 82, 83, 84, 85,
  86, 87, 88, 89, 148, 149, 2128, 2129, 152, 153, 96, 97, 98,
  99, 100, 101, 102, 103, 104, 105, 134, 135, 2144, 2145, 2184, 2185,
  112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 150, 151, 2160,
  2161, 2200, 2201, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265,
  384, 385, 2304, 2305, 2432, 2433, 272, 273, 274, 275, 276, 277, 278,
  279, 280, 281, 400, 401, 2320, 2321, 2448, 2449, 288, 289, 290, 291,
  292, 293, 294, 295, 296, 297, 386, 387, 2336, 2337, 2312, 2313, 304,
  305, 306, 307, 308, 309, 310, 311, 312, 313, 402, 403, 2352, 2353,
  2328, 2329, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 388,
  389, 2368, 2369, 392, 393, 336, 337, 338, 339, 340, 341, 342, 343,
  344, 345, 404, 405, 2384, 2385, 408, 409, 352, 353, 354, 355, 356,
  357, 358, 359, 360, 361, 390, 391, 2400, 2401, 2440, 2441, 368, 369,
  370, 371, 372, 373, 374, 375, 376, 377, 406, 407, 2416, 2417, 2456,
  2457, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 640, 641,
  2050, 2051, 2178, 2179, 528, 529, 530, 531, 532, 533, 534, 535, 536,
  537, 656, 657, 2066, 2067, 2194, 2195, 544, 545, 546, 547, 548, 549,
  550, 551, 552, 553, 642, 643, 2082, 2083, 2088, 2089, 560, 561, 562,
  563, 564, 565, 566, 567, 568, 569, 658, 659, 2098, 2099, 2104, 2105,
  576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 644, 645, 2114,
  2115, 648, 649, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601,
  660, 661, 2130, 2131, 664, 665, 608, 609, 610, 611, 612, 613, 614,
  615, 616, 617, 646, 647, 2146, 2147, 2184, 2185, 624, 625, 626, 627,
  628, 629, 630, 631, 632, 633, 662, 663, 2162, 2163, 2200, 2201, 768,
  769, 770, 771, 772, 773, 774, 775, 776, 777, 896, 897, 2306, 2307,
  2434, 2435, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 912,
  913, 2322, 2323, 2450, 2451, 800, 801, 802, 803, 804, 805, 806, 807,
  808, 809, 898, 899, 2338, 2339, 2344, 2345, 816, 817, 818, 819, 820,
  821, 822, 823, 824, 825, 914, 915, 2354, 2355, 2360, 2361, 832, 833,
  834, 835, 836, 837, 838, 839, 840, 841, 900, 901, 2370, 2371, 904,
  905, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 916, 917,
  2386, 2387, 920, 921, 864, 865, 866, 867, 868, 869, 870, 871, 872,
  873, 902, 903, 2402, 2403, 2440, 2441, 880, 881, 882, 883, 884, 885,
  886, 887, 888, 889, 918, 919, 2418, 2419, 2456, 2457, 1024, 1025, 1026,
  1027, 1028, 1029, 1030, 1031, 1032, 1033, 1152, 1153, 2052, 2053, 2180,
    2181,
  1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1168, 1169,
    2068,
  2069, 2196, 2197, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064,
    1065,
  1154, 1155, 2084, 2085, 2120, 2121, 1072, 1073, 1074, 1075, 1076, 1077,
    1078,
  1079, 1080, 1081, 1170, 1171, 2100, 2101, 2136, 2137, 1088, 1089, 1090,
    1091,
  1092, 1093, 1094, 1095, 1096, 1097, 1156, 1157, 2116, 2117, 1160, 1161,
    1104,
  1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1172, 1173, 2132,
    2133,
  1176, 1177, 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129,
    1158,
  1159, 2148, 2149, 2184, 2185, 1136, 1137, 1138, 1139, 1140, 1141, 1142,
    1143,
  1144, 1145, 1174, 1175, 2164, 2165, 2200, 2201, 1280, 1281, 1282, 1283,
    1284,
  1285, 1286, 1287, 1288, 1289, 1408, 1409, 2308, 2309, 2436, 2437, 1296,
    1297,
  1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1424, 1425, 2324, 2325,
    2452,
  2453, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1410,
    1411,
  2340, 2341, 2376, 2377, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335,
    1336,
  1337, 1426, 1427, 2356, 2357, 2392, 2393, 1344, 1345, 1346, 1347, 1348,
    1349,
  1350, 1351, 1352, 1353, 1412, 1413, 2372, 2373, 1416, 1417, 1360, 1361,
    1362,
  1363, 1364, 1365, 1366, 1367, 1368, 1369, 1428, 1429, 2388, 2389, 1432,
    1433,
  1376, 1377, 1378, 1379, 1380, 1381, 1382, 1383, 1384, 1385, 1414, 1415,
    2404,
  2405, 2440, 2441, 1392, 1393, 1394, 1395, 1396, 1397, 1398, 1399, 1400,
    1401,
  1430, 1431, 2420, 2421, 2456, 2457, 1536, 1537, 1538, 1539, 1540, 1541,
    1542,
  1543, 1544, 1545, 1664, 1665, 2054, 2055, 2182, 2183, 1552, 1553, 1554,
    1555,
  1556, 1557, 1558, 1559, 1560, 1561, 1680, 1681, 2070, 2071, 2198, 2199,
    1568,
  1569, 1570, 1571, 1572, 1573, 1574, 1575, 1576, 1577, 1666, 1667, 2086,
    2087,
  2152, 2153, 1584, 1585, 1586, 1587, 1588, 1589, 1590, 1591, 1592, 1593,
    1682,
  1683, 2102, 2103, 2168, 2169, 1600, 1601, 1602, 1603, 1604, 1605, 1606,
    1607,
  1608, 1609, 1668, 1669, 2118, 2119, 1672, 1673, 1616, 1617, 1618, 1619,
    1620,
  1621, 1622, 1623, 1624, 1625, 1684, 1685, 2134, 2135, 1688, 1689, 1632,
    1633,
  1634, 1635, 1636, 1637, 1638, 1639, 1640, 1641, 1670, 1671, 2150, 2151,
    2184,
  2185, 1648, 1649, 1650, 1651, 1652, 1653, 1654, 1655, 1656, 1657, 1686,
    1687,
  2166, 2167, 2200, 2201, 1792, 1793, 1794, 1795, 1796, 1797, 1798, 1799,
    1800,
  1801, 1920, 1921, 2310, 2311, 2438, 2439, 1808, 1809, 1810, 1811, 1812,
    1813,
  1814, 1815, 1816, 1817, 1936, 1937, 2326, 2327, 2454, 2455, 1824, 1825,
    1826,
  1827, 1828, 1829, 1830, 1831, 1832, 1833, 1922, 1923, 2342, 2343, 2408,
    2409,
  1840, 1841, 1842, 1843, 1844, 1845, 1846, 1847, 1848, 1849, 1938, 1939,
    2358,
  2359, 2424, 2425, 1856, 1857, 1858, 1859, 1860, 1861, 1862, 1863, 1864,
    1865,
  1924, 1925, 2374, 2375, 1928, 1929, 1872, 1873, 1874, 1875, 1876, 1877,
    1878,
  1879, 1880, 1881, 1940, 1941, 2390, 2391, 1944, 1945, 1888, 1889, 1890,
    1891,
  1892, 1893, 1894, 1895, 1896, 1897, 1926, 1927, 2406, 2407, 2440, 2441,
    1904,
  1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1942, 1943, 2422,
    2423,
  2456, 2457
};
#endif

#if DEC_BIN2DPD==1

const uint16_t BIN2DPD[1000] = { 0, 1, 2, 3, 4, 5, 6, 7,
  8, 9, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 32,
  33, 34, 35, 36, 37, 38, 39, 40, 41, 48, 49, 50, 51,
  52, 53, 54, 55, 56, 57, 64, 65, 66, 67, 68, 69, 70,
  71, 72, 73, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
  96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 112, 113, 114,
  115, 116, 117, 118, 119, 120, 121, 10, 11, 42, 43, 74, 75,
  106, 107, 78, 79, 26, 27, 58, 59, 90, 91, 122, 123, 94,
  95, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 144, 145,
  146, 147, 148, 149, 150, 151, 152, 153, 160, 161, 162, 163, 164,
  165, 166, 167, 168, 169, 176, 177, 178, 179, 180, 181, 182, 183,
  184, 185, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 208,
  209, 210, 211, 212, 213, 214, 215, 216, 217, 224, 225, 226, 227,
  228, 229, 230, 231, 232, 233, 240, 241, 242, 243, 244, 245, 246,
  247, 248, 249, 138, 139, 170, 171, 202, 203, 234, 235, 206, 207,
  154, 155, 186, 187, 218, 219, 250, 251, 222, 223, 256, 257, 258,
  259, 260, 261, 262, 263, 264, 265, 272, 273, 274, 275, 276, 277,
  278, 279, 280, 281, 288, 289, 290, 291, 292, 293, 294, 295, 296,
  297, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 320, 321,
  322, 323, 324, 325, 326, 327, 328, 329, 336, 337, 338, 339, 340,
  341, 342, 343, 344, 345, 352, 353, 354, 355, 356, 357, 358, 359,
  360, 361, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 266,
  267, 298, 299, 330, 331, 362, 363, 334, 335, 282, 283, 314, 315,
  346, 347, 378, 379, 350, 351, 384, 385, 386, 387, 388, 389, 390,
  391, 392, 393, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409,
  416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 432, 433, 434,
  435, 436, 437, 438, 439, 440, 441, 448, 449, 450, 451, 452, 453,
  454, 455, 456, 457, 464, 465, 466, 467, 468, 469, 470, 471, 472,
  473, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 496, 497,
  498, 499, 500, 501, 502, 503, 504, 505, 394, 395, 426, 427, 458,
  459, 490, 491, 462, 463, 410, 411, 442, 443, 474, 475, 506, 507,
  478, 479, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 528,
  529, 530, 531, 532, 533, 534, 535, 536, 537, 544, 545, 546, 547,
  548, 549, 550, 551, 552, 553, 560, 561, 562, 563, 564, 565, 566,
  567, 568, 569, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585,
  592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 608, 609, 610,
  611, 612, 613, 614, 615, 616, 617, 624, 625, 626, 627, 628, 629,
  630, 631, 632, 633, 522, 523, 554, 555, 586, 587, 618, 619, 590,
  591, 538, 539, 570, 571, 602, 603, 634, 635, 606, 607, 640, 641,
  642, 643, 644, 645, 646, 647, 648, 649, 656, 657, 658, 659, 660,
  661, 662, 663, 664, 665, 672, 673, 674, 675, 676, 677, 678, 679,
  680, 681, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 704,
  705, 706, 707, 708, 709, 710, 711, 712, 713, 720, 721, 722, 723,
  724, 725, 726, 727, 728, 729, 736, 737, 738, 739, 740, 741, 742,
  743, 744, 745, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761,
  650, 651, 682, 683, 714, 715, 746, 747, 718, 719, 666, 667, 698,
  699, 730, 731, 762, 763, 734, 735, 768, 769, 770, 771, 772, 773,
  774, 775, 776, 777, 784, 785, 786, 787, 788, 789, 790, 791, 792,
  793, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 816, 817,
  818, 819, 820, 821, 822, 823, 824, 825, 832, 833, 834, 835, 836,
  837, 838, 839, 840, 841, 848, 849, 850, 851, 852, 853, 854, 855,
  856, 857, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 880,
  881, 882, 883, 884, 885, 886, 887, 888, 889, 778, 779, 810, 811,
  842, 843, 874, 875, 846, 847, 794, 795, 826, 827, 858, 859, 890,
  891, 862, 863, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905,
  912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 928, 929, 930,
  931, 932, 933, 934, 935, 936, 937, 944, 945, 946, 947, 948, 949,
  950, 951, 952, 953, 960, 961, 962, 963, 964, 965, 966, 967, 968,
  969, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 992, 993,
  994, 995, 996, 997, 998, 999, 1000, 1001, 1008, 1009, 1010, 1011, 1012,
  1013, 1014, 1015, 1016, 1017, 906, 907, 938, 939, 970, 971, 1002, 1003,
  974, 975, 922, 923, 954, 955, 986, 987, 1018, 1019, 990, 991, 12,
  13, 268, 269, 524, 525, 780, 781, 46, 47, 28, 29, 284, 285,
  540, 541, 796, 797, 62, 63, 44, 45, 300, 301, 556, 557, 812,
  813, 302, 303, 60, 61, 316, 317, 572, 573, 828, 829, 318, 319,
  76, 77, 332, 333, 588, 589, 844, 845, 558, 559, 92, 93, 348,
  349, 604, 605, 860, 861, 574, 575, 108, 109, 364, 365, 620, 621,
  876, 877, 814, 815, 124, 125, 380, 381, 636, 637, 892, 893, 830,
  831, 14, 15, 270, 271, 526, 527, 782, 783, 110, 111, 30, 31,
  286, 287, 542, 543, 798, 799, 126, 127, 140, 141, 396, 397, 652,
  653, 908, 909, 174, 175, 156, 157, 412, 413, 668, 669, 924, 925,
  190, 191, 172, 173, 428, 429, 684, 685, 940, 941, 430, 431, 188,
  189, 444, 445, 700, 701, 956, 957, 446, 447, 204, 205, 460, 461,
  716, 717, 972, 973, 686, 687, 220, 221, 476, 477, 732, 733, 988,
  989, 702, 703, 236, 237, 492, 493, 748, 749, 1004, 1005, 942, 943,
  252, 253, 508, 509, 764, 765, 1020, 1021, 958, 959, 142, 143, 398,
  399, 654, 655, 910, 911, 238, 239, 158, 159, 414, 415, 670, 671,
  926, 927, 254, 255
};
#endif

#if DEC_DPD2BIN==1

const uint16_t DPD2BIN[1024] = { 0, 1, 2, 3, 4, 5, 6, 7,
  8, 9, 80, 81, 800, 801, 880, 881, 10, 11, 12, 13, 14,
  15, 16, 17, 18, 19, 90, 91, 810, 811, 890, 891, 20, 21,
  22, 23, 24, 25, 26, 27, 28, 29, 82, 83, 820, 821, 808,
  809, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 92, 93,
  830, 831, 818, 819, 40, 41, 42, 43, 44, 45, 46, 47, 48,
  49, 84, 85, 840, 841, 88, 89, 50, 51, 52, 53, 54, 55,
  56, 57, 58, 59, 94, 95, 850, 851, 98, 99, 60, 61, 62,
  63, 64, 65, 66, 67, 68, 69, 86, 87, 860, 861, 888, 889,
  70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 96, 97, 870,
  871, 898, 899, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
  180, 181, 900, 901, 980, 981, 110, 111, 112, 113, 114, 115, 116,
  117, 118, 119, 190, 191, 910, 911, 990, 991, 120, 121, 122, 123,
  124, 125, 126, 127, 128, 129, 182, 183, 920, 921, 908, 909, 130,
  131, 132, 133, 134, 135, 136, 137, 138, 139, 192, 193, 930, 931,
  918, 919, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 184,
  185, 940, 941, 188, 189, 150, 151, 152, 153, 154, 155, 156, 157,
  158, 159, 194, 195, 950, 951, 198, 199, 160, 161, 162, 163, 164,
  165, 166, 167, 168, 169, 186, 187, 960, 961, 988, 989, 170, 171,
  172, 173, 174, 175, 176, 177, 178, 179, 196, 197, 970, 971, 998,
  999, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 280, 281,
  802, 803, 882, 883, 210, 211, 212, 213, 214, 215, 216, 217, 218,
  219, 290, 291, 812, 813, 892, 893, 220, 221, 222, 223, 224, 225,
  226, 227, 228, 229, 282, 283, 822, 823, 828, 829, 230, 231, 232,
  233, 234, 235, 236, 237, 238, 239, 292, 293, 832, 833, 838, 839,
  240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 284, 285, 842,
  843, 288, 289, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259,
  294, 295, 852, 853, 298, 299, 260, 261, 262, 263, 264, 265, 266,
  267, 268, 269, 286, 287, 862, 863, 888, 889, 270, 271, 272, 273,
  274, 275, 276, 277, 278, 279, 296, 297, 872, 873, 898, 899, 300,
  301, 302, 303, 304, 305, 306, 307, 308, 309, 380, 381, 902, 903,
  982, 983, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 390,
  391, 912, 913, 992, 993, 320, 321, 322, 323, 324, 325, 326, 327,
  328, 329, 382, 383, 922, 923, 928, 929, 330, 331, 332, 333, 334,
  335, 336, 337, 338, 339, 392, 393, 932, 933, 938, 939, 340, 341,
  342, 343, 344, 345, 346, 347, 348, 349, 384, 385, 942, 943, 388,
  389, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 394, 395,
  952, 953, 398, 399, 360, 361, 362, 363, 364, 365, 366, 367, 368,
  369, 386, 387, 962, 963, 988, 989, 370, 371, 372, 373, 374, 375,
  376, 377, 378, 379, 396, 397, 972, 973, 998, 999, 400, 401, 402,
  403, 404, 405, 406, 407, 408, 409, 480, 481, 804, 805, 884, 885,
  410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 490, 491, 814,
  815, 894, 895, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429,
  482, 483, 824, 825, 848, 849, 430, 431, 432, 433, 434, 435, 436,
  437, 438, 439, 492, 493, 834, 835, 858, 859, 440, 441, 442, 443,
  444, 445, 446, 447, 448, 449, 484, 485, 844, 845, 488, 489, 450,
  451, 452, 453, 454, 455, 456, 457, 458, 459, 494, 495, 854, 855,
  498, 499, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 486,
  487, 864, 865, 888, 889, 470, 471, 472, 473, 474, 475, 476, 477,
  478, 479, 496, 497, 874, 875, 898, 899, 500, 501, 502, 503, 504,
  505, 506, 507, 508, 509, 580, 581, 904, 905, 984, 985, 510, 511,
  512, 513, 514, 515, 516, 517, 518, 519, 590, 591, 914, 915, 994,
  995, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 582, 583,
  924, 925, 948, 949, 530, 531, 532, 533, 534, 535, 536, 537, 538,
  539, 592, 593, 934, 935, 958, 959, 540, 541, 542, 543, 544, 545,
  546, 547, 548, 549, 584, 585, 944, 945, 588, 589, 550, 551, 552,
  553, 554, 555, 556, 557, 558, 559, 594, 595, 954, 955, 598, 599,
  560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 586, 587, 964,
  965, 988, 989, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579,
  596, 597, 974, 975, 998, 999, 600, 601, 602, 603, 604, 605, 606,
  607, 608, 609, 680, 681, 806, 807, 886, 887, 610, 611, 612, 613,
  614, 615, 616, 617, 618, 619, 690, 691, 816, 817, 896, 897, 620,
  621, 622, 623, 624, 625, 626, 627, 628, 629, 682, 683, 826, 827,
  868, 869, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 692,
  693, 836, 837, 878, 879, 640, 641, 642, 643, 644, 645, 646, 647,
  648, 649, 684, 685, 846, 847, 688, 689, 650, 651, 652, 653, 654,
  655, 656, 657, 658, 659, 694, 695, 856, 857, 698, 699, 660, 661,
  662, 663, 664, 665, 666, 667, 668, 669, 686, 687, 866, 867, 888,
  889, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 696, 697,
  876, 877, 898, 899, 700, 701, 702, 703, 704, 705, 706, 707, 708,
  709, 780, 781, 906, 907, 986, 987, 710, 711, 712, 713, 714, 715,
  716, 717, 718, 719, 790, 791, 916, 917, 996, 997, 720, 721, 722,
  723, 724, 725, 726, 727, 728, 729, 782, 783, 926, 927, 968, 969,
  730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 792, 793, 936,
  937, 978, 979, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749,
  784, 785, 946, 947, 788, 789, 750, 751, 752, 753, 754, 755, 756,
  757, 758, 759, 794, 795, 956, 957, 798, 799, 760, 761, 762, 763,
  764, 765, 766, 767, 768, 769, 786, 787, 966, 967, 988, 989, 770,
  771, 772, 773, 774, 775, 776, 777, 778, 779, 796, 797, 976, 977,
  998, 999
};
#endif