diff options
author | Michael Meissner <michael.meissner@amd.com> | 2007-03-24 17:04:47 +0000 |
---|---|---|
committer | Michael Meissner <meissner@gcc.gnu.org> | 2007-03-24 17:04:47 +0000 |
commit | 79b87c74d764bd42703818289685e48996b54eb8 (patch) | |
tree | ec50c8ab7786788a6da7d4f06b0cd93e9555d487 | |
parent | cca643862ddb1f61f200b567c667576d39961fb2 (diff) | |
download | gcc-79b87c74d764bd42703818289685e48996b54eb8.zip gcc-79b87c74d764bd42703818289685e48996b54eb8.tar.gz gcc-79b87c74d764bd42703818289685e48996b54eb8.tar.bz2 |
Add BID decimal support
Co-Authored-By: H.J. Lu <hongjiu.lu@intel.com>
Co-Authored-By: Marius Cornea <marius.cornea@intel.com>
From-SVN: r123185
42 files changed, 12540 insertions, 153 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6f14062..3f12200 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,68 @@ +2007-03-23 Michael Meissner <michael.meissner@amd.com> + H.J. Lu <hongjiu.lu@intel.com> + + * config/dfp-bit.h (DPD_BID_NAME): New macro to give either the + DPD or BID name. + (name macros): Use DPD_BID_NAME to convert names properly. + + * optabs.c (DECIMAL_PREFIX): Prefix string to use for the current + decimal floating point format. + (init_floating_libfuncs): Change decimal functions so that they + have a "bid_" prefix if the decimal system uses the BID format, + and "dpd_" prefix if the decimal system uses the DPD format. + (init_interclass_conv_libfuncs): Ditto. + (init_intraclass_conv_libfuncs): Ditto. + + * config.in (ENABLE_DECIMAL_BID_FORMAT): New macro to say we are + using the BID format. + + * configure.ac (ENABLE_DECIMAL_BID_FORMAT): Set to 1/0 to say + whether we are using the BID decimal format. + * configure: Regenerate. + + * c-cppbuiltin.c (c_cpp_builtins): Define __STDC_WANT_DEC_FP__ if + the compiler has decimal floating point enabled. Define + __DECIMAL_BID_FORMAT__ if BID decimal floating point is used + instead of DPD. + + * config.in (ENABLE_DECIMAL_BID_FORMAT): New macro to say we are + using the BID format. + + * configure.ac (ENABLE_DECIMAL_BID_FORMAT): Set to 1/0 to say + whether we are using the BID decimal format. + * configure: Regenerate. + + * c-cppbuiltin.c (c_cpp_builtins): Define __STDC_WANT_DEC_FP__ if + the compiler has decimal floating point enabled. Define + __DECIMAL_BID_FORMAT__ if BID decimal floating point is used + instead of DPD. + + * doc/install.texi (--enable-decimal-float): Document BID and DPD + options, and that it is enabled for i386/x86_64 systems. + + * Makefile.in (enable_decimal_float): New. + (DECNUMFMT): New. + (DECNUMINC): Add -I$(DECNUMFMT). + (DECNUM_H): Mov decimal32.h, decimal64.h and decimal128.h + to $(DECNUMFMT) from $(DECNUM). + + * configure.ac: Support * --enable-decimal-float={no,yes,bid,dpd}. + Substitute enable_decimal_float. + * configure: Regenerated. + + PR other/30529 + * config/dfp-bit.c (__dec_byte_swap): Use uint32_t instead of + unsigned long. + + * configure.ac: Enable decimal float for x86_64-*-linux*. + * configure: Regenerated. + + PR other/30530 + * dfp.c (decimal_real_arithmetic): Use decimal128FlipSign and + decimal128ClearSign to flip and clear the sign bit in decimal128. + (decimal_real_maxval): Set decimal128SetSign to set the sign + bit in decimal128. + 2007-03-23 Ian Lance Taylor <iant@google.com> * fold-const.c (fold_binary): Correct warning for X - c >= X. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index dc9d846..ea6255f 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -289,8 +289,10 @@ CPPLIB = ../libcpp/libcpp.a CPPINC = -I$(srcdir)/../libcpp/include # Where to find decNumber +enable_decimal_float = @enable_decimal_float@ DECNUM = $(srcdir)/../libdecnumber -DECNUMINC = -I$(DECNUM) -I../libdecnumber +DECNUMFMT = $(srcdir)/../libdecnumber/$(enable_decimal_float) +DECNUMINC = -I$(DECNUM) -I$(DECNUMFMT) -I../libdecnumber LIBDECNUMBER = ../libdecnumber/libdecnumber.a # Substitution type for target's getgroups 2nd arg. @@ -770,7 +772,7 @@ PREDICT_H = predict.h predict.def CPPLIB_H = $(srcdir)/../libcpp/include/line-map.h \ $(srcdir)/../libcpp/include/cpplib.h DECNUM_H = $(DECNUM)/decContext.h $(DECNUM)/decDPD.h $(DECNUM)/decNumber.h \ - $(DECNUM)/decimal32.h $(DECNUM)/decimal64.h $(DECNUM)/decimal128.h + $(DECNUMFMT)/decimal32.h $(DECNUMFMT)/decimal64.h $(DECNUMFMT)/decimal128.h MKDEPS_H = $(srcdir)/../libcpp/include/mkdeps.h SYMTAB_H = $(srcdir)/../libcpp/include/symtab.h CPP_ID_DATA_H = $(CPPLIB_H) $(srcdir)/../libcpp/include/cpp-id-data.h diff --git a/gcc/c-cppbuiltin.c b/gcc/c-cppbuiltin.c index e9f608e..d27b96b 100644 --- a/gcc/c-cppbuiltin.c +++ b/gcc/c-cppbuiltin.c @@ -605,6 +605,17 @@ c_cpp_builtins (cpp_reader *pfile) new appearance would clobber any existing args. */ if (TARGET_DECLSPEC) builtin_define ("__declspec(x)=__attribute__((x))"); + + /* Tell the user whether decimal floating point is supported, + and if it is supported, whether the alternate format (BID) + is used over the standard (DPD) format. */ + + if (ENABLE_DECIMAL_FLOAT) + { + cpp_define (pfile, "__STDC_WANT_DEC_FP__"); + if (ENABLE_DECIMAL_BID_FORMAT) + cpp_define (pfile, "__DECIMAL_BID_FORMAT__"); + } } /* Pass an object-like macro. If it doesn't lie in the user's diff --git a/gcc/config.in b/gcc/config.in index 69f7e9e..7e60a3e 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -52,6 +52,12 @@ #endif +/* Define to 1 to say we are using the BID decimal format */ +#ifndef USED_FOR_TARGET +#undef ENABLE_DECIMAL_BID_FORMAT +#endif + + /* Define if you want fold checked that it never destructs its argument. This is quite expensive. */ #ifndef USED_FOR_TARGET diff --git a/gcc/config/dfp-bit.c b/gcc/config/dfp-bit.c index 2fa8999..af1db16 100644 --- a/gcc/config/dfp-bit.c +++ b/gcc/config/dfp-bit.c @@ -1,5 +1,5 @@ /* This is a software decimal floating point library. - Copyright (C) 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of GCC. @@ -66,7 +66,7 @@ typedef decNumber* (*dfp_unary_func) typedef decNumber* (*dfp_binary_func) (decNumber *, const decNumber *, const decNumber *, decContext *); -extern unsigned long __dec_byte_swap (unsigned long); +extern uint32_t __dec_byte_swap (uint32_t); /* Unary operations. */ diff --git a/gcc/config/dfp-bit.h b/gcc/config/dfp-bit.h index 1bbe156..5238a2b 100644 --- a/gcc/config/dfp-bit.h +++ b/gcc/config/dfp-bit.h @@ -1,5 +1,5 @@ /* Header file for dfp-bit.c. - Copyright (C) 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of GCC. @@ -288,63 +288,69 @@ extern float strtof (const char *, char **); /* Names of arithmetic functions. */ +#if ENABLE_DECIMAL_BID_FORMAT +#define DPD_BID_NAME(DPD,BID) BID +#else +#define DPD_BID_NAME(DPD,BID) DPD +#endif + #if WIDTH == 32 -#define DFP_ADD __addsd3 -#define DFP_SUB __subsd3 -#define DFP_MULTIPLY __mulsd3 -#define DFP_DIVIDE __divsd3 -#define DFP_EQ __eqsd2 -#define DFP_NE __nesd2 -#define DFP_LT __ltsd2 -#define DFP_GT __gtsd2 -#define DFP_LE __lesd2 -#define DFP_GE __gesd2 -#define DFP_UNORD __unordsd2 +#define DFP_ADD DPD_BID_NAME(__dpd_addsd3,__bid_addsd3) +#define DFP_SUB DPD_BID_NAME(__dpd_subsd3,__bid_subsd3) +#define DFP_MULTIPLY DPD_BID_NAME(__dpd_mulsd3,__bid_mulsd3) +#define DFP_DIVIDE DPD_BID_NAME(__dpd_divsd3,__bid_divsd3) +#define DFP_EQ DPD_BID_NAME(__dpd_eqsd2,__bid_eqsd2) +#define DFP_NE DPD_BID_NAME(__dpd_nesd2,__bid_nesd2) +#define DFP_LT DPD_BID_NAME(__dpd_ltsd2,__bid_ltsd2) +#define DFP_GT DPD_BID_NAME(__dpd_gtsd2,__bid_gtsd2) +#define DFP_LE DPD_BID_NAME(__dpd_lesd2,__bid_lesd2) +#define DFP_GE DPD_BID_NAME(__dpd_gesd2,__bid_gesd2) +#define DFP_UNORD DPD_BID_NAME(__dpd_unordsd2,__bid_unordsd2) #elif WIDTH == 64 -#define DFP_ADD __adddd3 -#define DFP_SUB __subdd3 -#define DFP_MULTIPLY __muldd3 -#define DFP_DIVIDE __divdd3 -#define DFP_EQ __eqdd2 -#define DFP_NE __nedd2 -#define DFP_LT __ltdd2 -#define DFP_GT __gtdd2 -#define DFP_LE __ledd2 -#define DFP_GE __gedd2 -#define DFP_UNORD __unorddd2 +#define DFP_ADD DPD_BID_NAME(__dpd_adddd3,__bid_adddd3) +#define DFP_SUB DPD_BID_NAME(__dpd_subdd3,__bid_subdd3) +#define DFP_MULTIPLY DPD_BID_NAME(__dpd_muldd3,__bid_muldd3) +#define DFP_DIVIDE DPD_BID_NAME(__dpd_divdd3,__bid_divdd3) +#define DFP_EQ DPD_BID_NAME(__dpd_eqdd2,__bid_eqdd2) +#define DFP_NE DPD_BID_NAME(__dpd_nedd2,__bid_nedd2) +#define DFP_LT DPD_BID_NAME(__dpd_ltdd2,__bid_ltdd2) +#define DFP_GT DPD_BID_NAME(__dpd_gtdd2,__bid_gtdd2) +#define DFP_LE DPD_BID_NAME(__dpd_ledd2,__bid_ledd2) +#define DFP_GE DPD_BID_NAME(__dpd_gedd2,__bid_gedd2) +#define DFP_UNORD DPD_BID_NAME(__dpd_unorddd2,__bid_unorddd2) #elif WIDTH == 128 -#define DFP_ADD __addtd3 -#define DFP_SUB __subtd3 -#define DFP_MULTIPLY __multd3 -#define DFP_DIVIDE __divtd3 -#define DFP_EQ __eqtd2 -#define DFP_NE __netd2 -#define DFP_LT __lttd2 -#define DFP_GT __gttd2 -#define DFP_LE __letd2 -#define DFP_GE __getd2 -#define DFP_UNORD __unordtd2 +#define DFP_ADD DPD_BID_NAME(__dpd_addtd3,__bid_addtd3) +#define DFP_SUB DPD_BID_NAME(__dpd_subtd3,__bid_subtd3) +#define DFP_MULTIPLY DPD_BID_NAME(__dpd_multd3,__bid_multd3) +#define DFP_DIVIDE DPD_BID_NAME(__dpd_divtd3,__bid_divtd3) +#define DFP_EQ DPD_BID_NAME(__dpd_eqtd2,__bid_eqtd2) +#define DFP_NE DPD_BID_NAME(__dpd_netd2,__bid_netd2) +#define DFP_LT DPD_BID_NAME(__dpd_lttd2,__bid_lttd2) +#define DFP_GT DPD_BID_NAME(__dpd_gttd2,__bid_gttd2) +#define DFP_LE DPD_BID_NAME(__dpd_letd2,__bid_letd2) +#define DFP_GE DPD_BID_NAME(__dpd_getd2,__bid_getd2) +#define DFP_UNORD DPD_BID_NAME(__dpd_unordtd2,__bid_unordtd2) #endif /* Names of functions to convert between different decimal float types. */ #if WIDTH == 32 #if WIDTH_TO == 64 -#define DFP_TO_DFP __extendsddd2 +#define DFP_TO_DFP DPD_BID_NAME(__dpd_extendsddd2,__bid_extendsddd2) #elif WIDTH_TO == 128 -#define DFP_TO_DFP __extendsdtd2 +#define DFP_TO_DFP DPD_BID_NAME(__dpd_extendsdtd2,__bid_extendsdtd2) #endif #elif WIDTH == 64 #if WIDTH_TO == 32 -#define DFP_TO_DFP __truncddsd2 +#define DFP_TO_DFP DPD_BID_NAME(__dpd_truncddsd2,__bid_truncddsd2) #elif WIDTH_TO == 128 -#define DFP_TO_DFP __extendddtd2 +#define DFP_TO_DFP DPD_BID_NAME(__dpd_extendddtd2,__bid_extendddtd2) #endif #elif WIDTH == 128 #if WIDTH_TO == 32 -#define DFP_TO_DFP __trunctdsd2 +#define DFP_TO_DFP DPD_BID_NAME(__dpd_trunctdsd2,__bid_trunctdsd2) #elif WIDTH_TO == 64 -#define DFP_TO_DFP __trunctddd2 +#define DFP_TO_DFP DPD_BID_NAME(__dpd_trunctddd2,__bid_trunctddd2) #endif #endif @@ -352,45 +358,45 @@ extern float strtof (const char *, char **); #if WIDTH == 32 #if INT_KIND == 1 -#define INT_TO_DFP __floatsisd -#define DFP_TO_INT __fixsdsi +#define INT_TO_DFP DPD_BID_NAME(__dpd_floatsisd,__bid_floatsisd) +#define DFP_TO_INT DPD_BID_NAME(__dpd_fixsdsi,__bid_fixsdsi) #elif INT_KIND == 2 -#define INT_TO_DFP __floatdisd -#define DFP_TO_INT __fixsddi +#define INT_TO_DFP DPD_BID_NAME(__dpd_floatdisd,__bid_floatdisd) +#define DFP_TO_INT DPD_BID_NAME(__dpd_fixsddi,__bid_fixsddi) #elif INT_KIND == 3 -#define INT_TO_DFP __floatunssisd -#define DFP_TO_INT __fixunssdsi +#define INT_TO_DFP DPD_BID_NAME(__dpd_floatunssisd,__bid_floatunssisd) +#define DFP_TO_INT DPD_BID_NAME(__dpd_fixunssdsi,__bid_fixunssdsi) #elif INT_KIND == 4 -#define INT_TO_DFP __floatunsdisd -#define DFP_TO_INT __fixunssddi +#define INT_TO_DFP DPD_BID_NAME(__dpd_floatunsdisd,__bid_floatunsdisd) +#define DFP_TO_INT DPD_BID_NAME(__dpd_fixunssddi,__bid_fixunssddi) #endif #elif WIDTH == 64 #if INT_KIND == 1 -#define INT_TO_DFP __floatsidd -#define DFP_TO_INT __fixddsi +#define INT_TO_DFP DPD_BID_NAME(__dpd_floatsidd,__bid_floatsidd) +#define DFP_TO_INT DPD_BID_NAME(__dpd_fixddsi,__bid_fixddsi) #elif INT_KIND == 2 -#define INT_TO_DFP __floatdidd -#define DFP_TO_INT __fixdddi +#define INT_TO_DFP DPD_BID_NAME(__dpd_floatdidd,__bid_floatdidd) +#define DFP_TO_INT DPD_BID_NAME(__dpd_fixdddi,__bid_fixdddi) #elif INT_KIND == 3 -#define INT_TO_DFP __floatunssidd -#define DFP_TO_INT __fixunsddsi +#define INT_TO_DFP DPD_BID_NAME(__dpd_floatunssidd,__bid_floatunssidd) +#define DFP_TO_INT DPD_BID_NAME(__dpd_fixunsddsi,__bid_fixunsddsi) #elif INT_KIND == 4 -#define INT_TO_DFP __floatunsdidd -#define DFP_TO_INT __fixunsdddi +#define INT_TO_DFP DPD_BID_NAME(__dpd_floatunsdidd,__bid_floatunsdidd) +#define DFP_TO_INT DPD_BID_NAME(__dpd_fixunsdddi,__bid_fixunsdddi) #endif #elif WIDTH == 128 #if INT_KIND == 1 -#define INT_TO_DFP __floatsitd -#define DFP_TO_INT __fixtdsi +#define INT_TO_DFP DPD_BID_NAME(__dpd_floatsitd,__bid_floatsitd) +#define DFP_TO_INT DPD_BID_NAME(__dpd_fixtdsi,__bid_fixtdsi) #elif INT_KIND == 2 -#define INT_TO_DFP __floatditd -#define DFP_TO_INT __fixtddi +#define INT_TO_DFP DPD_BID_NAME(__dpd_floatditd,__bid_floatditd) +#define DFP_TO_INT DPD_BID_NAME(__dpd_fixtddi,__bid_fixtddi) #elif INT_KIND == 3 -#define INT_TO_DFP __floatunssitd -#define DFP_TO_INT __fixunstdsi +#define INT_TO_DFP DPD_BID_NAME(__dpd_floatunssitd,__bid_floatunssitd) +#define DFP_TO_INT DPD_BID_NAME(__dpd_fixunstdsi,__bid_fixunstdsi) #elif INT_KIND == 4 -#define INT_TO_DFP __floatunsditd -#define DFP_TO_INT __fixunstddi +#define INT_TO_DFP DPD_BID_NAME(__dpd_floatunsditd,__bid_floatunsditd) +#define DFP_TO_INT DPD_BID_NAME(__dpd_fixunstddi,__bid_fixunstddi) #endif #endif @@ -398,38 +404,38 @@ extern float strtof (const char *, char **); #if WIDTH == 32 #if BFP_KIND == 1 -#define BFP_TO_DFP __extendsfsd -#define DFP_TO_BFP __truncsdsf +#define BFP_TO_DFP DPD_BID_NAME(__dpd_extendsfsd,__bid_extendsfsd) +#define DFP_TO_BFP DPD_BID_NAME(__dpd_truncsdsf,__bid_truncsdsf) #elif BFP_KIND == 2 -#define BFP_TO_DFP __truncdfsd -#define DFP_TO_BFP __extendsddf +#define BFP_TO_DFP DPD_BID_NAME(__dpd_truncdfsd,__bid_truncdfsd) +#define DFP_TO_BFP DPD_BID_NAME(__dpd_extendsddf,__bid_extendsddf) #elif BFP_KIND == 3 -#define BFP_TO_DFP __truncxfsd -#define DFP_TO_BFP __extendsdxf +#define BFP_TO_DFP DPD_BID_NAME(__dpd_truncxfsd,__bid_truncxfsd) +#define DFP_TO_BFP DPD_BID_NAME(__dpd_extendsdxf,__bid_extendsdxf) #endif /* BFP_KIND */ #elif WIDTH == 64 #if BFP_KIND == 1 -#define BFP_TO_DFP __extendsfdd -#define DFP_TO_BFP __truncddsf +#define BFP_TO_DFP DPD_BID_NAME(__dpd_extendsfdd,__bid_extendsfdd) +#define DFP_TO_BFP DPD_BID_NAME(__dpd_truncddsf,__bid_truncddsf) #elif BFP_KIND == 2 -#define BFP_TO_DFP __extenddfdd -#define DFP_TO_BFP __truncdddf +#define BFP_TO_DFP DPD_BID_NAME(__dpd_extenddfdd,__bid_extenddfdd) +#define DFP_TO_BFP DPD_BID_NAME(__dpd_truncdddf,__bid_truncdddf) #elif BFP_KIND == 3 -#define BFP_TO_DFP __truncxfdd -#define DFP_TO_BFP __extendddxf +#define BFP_TO_DFP DPD_BID_NAME(__dpd_truncxfdd,__bid_truncxfdd) +#define DFP_TO_BFP DPD_BID_NAME(__dpd_extendddxf,__bid_extendddxf) #endif /* BFP_KIND */ #elif WIDTH == 128 #if BFP_KIND == 1 -#define BFP_TO_DFP __extendsftd -#define DFP_TO_BFP __trunctdsf +#define BFP_TO_DFP DPD_BID_NAME(__dpd_extendsftd,__bid_extendsftd) +#define DFP_TO_BFP DPD_BID_NAME(__dpd_trunctdsf,__bid_trunctdsf) #elif BFP_KIND == 2 -#define BFP_TO_DFP __extenddftd -#define DFP_TO_BFP __trunctddf +#define BFP_TO_DFP DPD_BID_NAME(__dpd_extenddftd,__bid_extenddftd) +#define DFP_TO_BFP DPD_BID_NAME(__dpd_trunctddf,__bid_trunctddf) #elif BFP_KIND == 3 -#define BFP_TO_DFP __extendxftd -#define DFP_TO_BFP __trunctdxf +#define BFP_TO_DFP DPD_BID_NAME(__dpd_extendxftd,__bid_extendxftd) +#define DFP_TO_BFP DPD_BID_NAME(__dpd_trunctdxf,__bid_trunctdxf) #endif /* BFP_KIND */ #endif /* WIDTH */ diff --git a/gcc/configure b/gcc/configure index 0cecbcd..627c946 100755 --- a/gcc/configure +++ b/gcc/configure @@ -879,7 +879,10 @@ Optional Features: --enable-gather-detailed-mem-stats enable detailed memory allocation stats gathering --enable-multilib enable library support for multiple ABIs --enable-__cxa_atexit enable __cxa_atexit for C++ - --enable-decimal-float enable decimal float extension to C + --enable-decimal-float={no,yes,bid,dpd} + enable decimal float extension to C. Selecting 'bid' + or 'dpd' choses which decimal floating point format + to use --enable-threads enable thread usage for target GCC --enable-threads=LIB use LIB thread package for target GCC --enable-tls enable or disable generation of tls code @@ -7012,9 +7015,19 @@ fi; if test "${enable_decimal_float+set}" = set; then enableval="$enable_decimal_float" - if test x$enablevar = xyes ; then - case $target in - powerpc*-*-linux* | i?86*-*-linux*) + case $enable_decimal_float in + yes | no | bid | dpd) ;; + *) { { echo "$as_me:$LINENO: error: '$enable_decimal_float' is an invalid value for --enable-decimal-float. +Valid choices are 'yes', 'bid', 'dpd', and 'no'." >&5 +echo "$as_me: error: '$enable_decimal_float' is an invalid value for --enable-decimal-float. +Valid choices are 'yes', 'bid', 'dpd', and 'no'." >&2;} + { (exit 1); exit 1; }; } ;; + esac + +else + + case $target in + powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux*) enable_decimal_float=yes ;; *) @@ -7022,19 +7035,41 @@ if test "${enable_decimal_float+set}" = set; then echo "$as_me: WARNING: decimal float is not supported for this target" >&2;} enable_decimal_float=no ;; - esac - fi + esac -else - enable_decimal_float=no fi; +dfp=`if test $enable_decimal_float != no; then echo 1; else echo 0; fi` +cat >>confdefs.h <<_ACEOF +#define ENABLE_DECIMAL_FLOAT $dfp +_ACEOF -dfp=`if test $enable_decimal_float = yes; then echo 1; else echo 0; fi` + +# x86's use BID format instead of DPD +case x$enable_decimal_float in + xyes) + case $target in + i?86*-*-linux* | x86_64*-*-linux*) + enable_decimal_float=bid + ;; + *) + enable_decimal_float=dpd + ;; + esac + ;; + xno) + # ENABLE_DECIMAL_FLOAT is set to 0. But we have to have proper + # dependency on libdecnumber. + enable_decimal_float=dpd + ;; +esac + + +bid=`if test $enable_decimal_float = bid; then echo 1; else echo 0; fi` cat >>confdefs.h <<_ACEOF -#define ENABLE_DECIMAL_FLOAT $dfp +#define ENABLE_DECIMAL_BID_FORMAT $bid _ACEOF @@ -7630,7 +7665,7 @@ if test "${gcc_cv_prog_makeinfo_modern+set}" = set; then else ac_prog_version=`$MAKEINFO --version 2>&1 | sed -n 's/^.*GNU texinfo.* \([0-9][0-9.]*\).*$/\1/p'` - echo "configure:7633: version of makeinfo is $ac_prog_version" >&5 + echo "configure:7668: version of makeinfo is $ac_prog_version" >&5 case $ac_prog_version in '') gcc_cv_prog_makeinfo_modern=no;; 4.[4-9]*) diff --git a/gcc/configure.ac b/gcc/configure.ac index f3a6236..226b62a 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -667,27 +667,58 @@ AC_ARG_ENABLE(__cxa_atexit, # Enable C extension for decimal float if target supports it. AC_ARG_ENABLE(decimal-float, -[ --enable-decimal-float enable decimal float extension to C], +[ --enable-decimal-float={no,yes,bid,dpd} + enable decimal float extension to C. Selecting 'bid' + or 'dpd' choses which decimal floating point format + to use], [ - if test x$enablevar = xyes ; then - case $target in - powerpc*-*-linux* | i?86*-*-linux*) + case $enable_decimal_float in + yes | no | bid | dpd) ;; + *) AC_MSG_ERROR(['$enable_decimal_float' is an invalid value for --enable-decimal-float. +Valid choices are 'yes', 'bid', 'dpd', and 'no'.]) ;; + esac +], +[ + case $target in + powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux*) enable_decimal_float=yes ;; *) AC_MSG_WARN(decimal float is not supported for this target, ignored) enable_decimal_float=no ;; - esac - fi -], [enable_decimal_float=no]) - -AC_SUBST(enable_decimal_float) + esac +]) -dfp=`if test $enable_decimal_float = yes; then echo 1; else echo 0; fi` +dfp=`if test $enable_decimal_float != no; then echo 1; else echo 0; fi` AC_DEFINE_UNQUOTED(ENABLE_DECIMAL_FLOAT, $dfp, [Define to 1 to enable decimal float extension to C.]) +# x86's use BID format instead of DPD +case x$enable_decimal_float in + xyes) + case $target in + i?86*-*-linux* | x86_64*-*-linux*) + enable_decimal_float=bid + ;; + *) + enable_decimal_float=dpd + ;; + esac + ;; + xno) + # ENABLE_DECIMAL_FLOAT is set to 0. But we have to have proper + # dependency on libdecnumber. + enable_decimal_float=dpd + ;; +esac +AC_SUBST(enable_decimal_float) + +bid=`if test $enable_decimal_float = bid; then echo 1; else echo 0; fi` +AC_DEFINE_UNQUOTED(ENABLE_DECIMAL_BID_FORMAT, $bid, +[Define to 1 to specify that we are using the BID decimal floating +point format instead of DPD]) + # Enable threads # Pass with no value to take the default # Pass with a value to specify a thread package @@ -1,5 +1,5 @@ /* Decimal floating point support. - Copyright (C) 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of GCC. @@ -656,11 +656,9 @@ decimal_real_arithmetic (REAL_VALUE_TYPE *r, enum tree_code code, case NEGATE_EXPR: { - decimal128 *d128; *r = *op0; - d128 = (decimal128 *) r->sig; - /* Flip high bit. */ - d128->bytes[0] ^= 1 << 7; + /* Flip sign bit. */ + decimal128FlipSign ((decimal128 *) r->sig); /* Keep sign field in sync. */ r->sign ^= 1; } @@ -668,11 +666,9 @@ decimal_real_arithmetic (REAL_VALUE_TYPE *r, enum tree_code code, case ABS_EXPR: { - decimal128 *d128; *r = *op0; - d128 = (decimal128 *) r->sig; - /* Clear high bit. */ - d128->bytes[0] &= 0x7f; + /* Clear sign bit. */ + decimal128ClearSign ((decimal128 *) r->sig); /* Keep sign field in sync. */ r->sign = 0; } @@ -712,5 +708,5 @@ decimal_real_maxval (REAL_VALUE_TYPE *r, int sign, enum machine_mode mode) decimal_real_from_string (r, max); if (sign) - r->sig[0] |= 0x80000000; + decimal128SetSign ((decimal128 *) r->sig, 1); } diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 569a399..76545c0 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -1304,11 +1304,20 @@ is removed entirely in the next major release, unless someone steps forward to maintain the port. @item --enable-decimal-float +@itemx --enable-decimal-float=yes +@itemx --enable-decimal-float=no +@itemx --enable-decimal-float=bid +@itemx --enable-decimal-float=dpd @itemx --disable-decimal-float -Enable (or disable) support for the C decimal floating point -extension. This is enabled by default only on PowerPC GNU/Linux -systems. Other systems may also support it, but require the user to -specifically enable it. +Enable (or disable) support for the C decimal floating point extension +that is in the IEEE 754R extension to the IEEE754 floating point +standard. This is enabled by default only on PowerPC, i386, and +x86_64 GNU/Linux systems. Other systems may also support it, but +require the user to specifically enable it. You can optionally +control which decimal floating point format is used (either @samp{bid} +or @samp{dpd}). The @samp{bid} (binary integer decimal) format is +default on i386 and x86_64 systems, and the @samp{dpd} (densely packed +decimal) format is default on PowerPC systems. @item --with-long-double-128 Specify if @code{long double} type should be 128-bit by default on selected diff --git a/gcc/optabs.c b/gcc/optabs.c index 51c84c8..94e3691 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -130,6 +130,14 @@ static rtx vector_compare_rtx (tree, bool, enum insn_code); #define HAVE_conditional_trap 0 #define gen_conditional_trap(a,b) (gcc_unreachable (), NULL_RTX) #endif + +/* Prefixes for the current version of decimal floating point (BID vs. DPD) */ +#if ENABLE_DECIMAL_BID_FORMAT +#define DECIMAL_PREFIX "bid_" +#else +#define DECIMAL_PREFIX "dpd_" +#endif + /* Add a REG_EQUAL note to the last insn in INSNS. TARGET is being set to the result of operation CODE applied to OP0 (and OP1 if it is a binary @@ -5177,9 +5185,16 @@ init_integral_libfuncs (optab optable, const char *opname, int suffix) static void init_floating_libfuncs (optab optable, const char *opname, int suffix) { + char *dec_opname = alloca (sizeof (DECIMAL_PREFIX) + strlen (opname)); + + /* For BID support, change the name to have either a bid_ or dpd_ prefix + depending on the low level floating format used. */ + memcpy (dec_opname, DECIMAL_PREFIX, sizeof (DECIMAL_PREFIX) - 1); + strcpy (dec_opname + sizeof (DECIMAL_PREFIX) - 1, opname); + init_libfuncs (optable, MIN_MODE_FLOAT, MAX_MODE_FLOAT, opname, suffix); init_libfuncs (optable, MIN_MODE_DECIMAL_FLOAT, MAX_MODE_DECIMAL_FLOAT, - opname, suffix); + dec_opname, suffix); } /* Initialize the libfunc fields of an entire group of entries of an @@ -5201,8 +5216,13 @@ init_interclass_conv_libfuncs (convert_optab tab, const char *opname, const char *fname, *tname; const char *q; char *libfunc_name, *suffix; + char *nondec_name, *dec_name, *nondec_suffix, *dec_suffix; char *p; + /* If this is a decimal conversion, add the current BID vs. DPD prefix that + depends on which underlying decimal floating point format is used. */ + const size_t dec_len = sizeof (DECIMAL_PREFIX) - 1; + for (fmode = first_from_mode; fmode != VOIDmode; fmode = GET_MODE_WIDER_MODE (fmode)) @@ -5213,11 +5233,18 @@ init_interclass_conv_libfuncs (convert_optab tab, const char *opname, tmode = GET_MODE_WIDER_MODE (tmode)) max_mname_len = MAX (max_mname_len, strlen (GET_MODE_NAME (tmode))); - libfunc_name = alloca (2 + opname_len + 2*max_mname_len + 1 + 1); - libfunc_name[0] = '_'; - libfunc_name[1] = '_'; - memcpy (&libfunc_name[2], opname, opname_len); - suffix = libfunc_name + opname_len + 2; + nondec_name = alloca (2 + opname_len + 2*max_mname_len + 1 + 1); + nondec_name[0] = '_'; + nondec_name[1] = '_'; + memcpy (&nondec_name[2], opname, opname_len); + nondec_suffix = nondec_name + opname_len + 2; + + dec_name = alloca (2 + dec_len + opname_len + 2*max_mname_len + 1 + 1); + dec_name[0] = '_'; + dec_name[1] = '_'; + memcpy (&dec_name[2], DECIMAL_PREFIX, dec_len); + memcpy (&dec_name[2+dec_len], opname, opname_len); + dec_suffix = dec_name + dec_len + opname_len + 2; for (fmode = first_from_mode; fmode != VOIDmode; fmode = GET_MODE_WIDER_MODE (fmode)) @@ -5227,6 +5254,17 @@ init_interclass_conv_libfuncs (convert_optab tab, const char *opname, fname = GET_MODE_NAME (fmode); tname = GET_MODE_NAME (tmode); + if (DECIMAL_FLOAT_MODE_P(fmode) || DECIMAL_FLOAT_MODE_P(tmode)) + { + libfunc_name = dec_name; + suffix = dec_suffix; + } + else + { + libfunc_name = nondec_name; + suffix = nondec_suffix; + } + p = suffix; for (q = fname; *q; p++, q++) *p = TOLOWER (*q); @@ -5257,18 +5295,30 @@ init_intraclass_conv_libfuncs (convert_optab tab, const char *opname, enum machine_mode nmode, wmode; const char *nname, *wname; const char *q; + char *nondec_name, *dec_name, *nondec_suffix, *dec_suffix; char *libfunc_name, *suffix; char *p; + /* If this is a decimal conversion, add the current BID vs. DPD prefix that + depends on which underlying decimal floating point format is used. */ + const size_t dec_len = sizeof (DECIMAL_PREFIX) - 1; + for (nmode = first_mode; nmode != VOIDmode; nmode = GET_MODE_WIDER_MODE (nmode)) max_mname_len = MAX (max_mname_len, strlen (GET_MODE_NAME (nmode))); - libfunc_name = alloca (2 + opname_len + 2*max_mname_len + 1 + 1); - libfunc_name[0] = '_'; - libfunc_name[1] = '_'; - memcpy (&libfunc_name[2], opname, opname_len); - suffix = libfunc_name + opname_len + 2; + nondec_name = alloca (2 + opname_len + 2*max_mname_len + 1 + 1); + nondec_name[0] = '_'; + nondec_name[1] = '_'; + memcpy (&nondec_name[2], opname, opname_len); + nondec_suffix = nondec_name + opname_len + 2; + + dec_name = alloca (2 + dec_len + opname_len + 2*max_mname_len + 1 + 1); + dec_name[0] = '_'; + dec_name[1] = '_'; + memcpy (&dec_name[2], DECIMAL_PREFIX, dec_len); + memcpy (&dec_name[2 + dec_len], opname, opname_len); + dec_suffix = dec_name + dec_len + opname_len + 2; for (nmode = first_mode; nmode != VOIDmode; nmode = GET_MODE_WIDER_MODE (nmode)) @@ -5278,6 +5328,17 @@ init_intraclass_conv_libfuncs (convert_optab tab, const char *opname, nname = GET_MODE_NAME (nmode); wname = GET_MODE_NAME (wmode); + if (DECIMAL_FLOAT_MODE_P(nmode) || DECIMAL_FLOAT_MODE_P(wmode)) + { + libfunc_name = dec_name; + suffix = dec_suffix; + } + else + { + libfunc_name = nondec_name; + suffix = nondec_suffix; + } + p = suffix; for (q = widening ? nname : wname; *q; p++, q++) *p = TOLOWER (*q); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b5049ac..39365b7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2007-03-23 Michael Meissner <michael.meissner@amd.com> + + * gcc.dg/dfp/convert-dfp.c: Wrap __STDC_WANT_DEC_FP__ with + #ifndef/#endif. + * gcc.dg/dfp/convert-int-saturate.c: Ditto. + * gcc.dg/dfp/decfloat-constants.c: Ditto. + 2007-03-24 Paul Thomas <pault@gcc.gnu.org> PR fortran/31209 diff --git a/gcc/testsuite/gcc.dg/dfp/convert-dfp.c b/gcc/testsuite/gcc.dg/dfp/convert-dfp.c index 5afdcf0..b84e67d 100644 --- a/gcc/testsuite/gcc.dg/dfp/convert-dfp.c +++ b/gcc/testsuite/gcc.dg/dfp/convert-dfp.c @@ -6,7 +6,10 @@ Test various conversions involving decimal floating types. */ +#ifndef __STDC_WANT_DEC_FP__ #define __STDC_WANT_DEC_FP__ 1 +#endif + #include <float.h> extern void abort (void); diff --git a/gcc/testsuite/gcc.dg/dfp/convert-int-saturate.c b/gcc/testsuite/gcc.dg/dfp/convert-int-saturate.c index aeaa465..ab4c8d2 100644 --- a/gcc/testsuite/gcc.dg/dfp/convert-int-saturate.c +++ b/gcc/testsuite/gcc.dg/dfp/convert-int-saturate.c @@ -4,7 +4,10 @@ C99 6.3.1.4(1a) New. Test integer saturation. */ +#ifndef __STDC_WANT_DEC_FP__ #define __STDC_WANT_DEC_FP__ 1 +#endif + #include <float.h> #include <limits.h> diff --git a/gcc/testsuite/gcc.dg/dfp/decfloat-constants.c b/gcc/testsuite/gcc.dg/dfp/decfloat-constants.c index 4980c65..87c9849 100644 --- a/gcc/testsuite/gcc.dg/dfp/decfloat-constants.c +++ b/gcc/testsuite/gcc.dg/dfp/decfloat-constants.c @@ -7,7 +7,10 @@ decimal float defined in float.h. */ /* Make sure we are exporting the right values to float.h. */ +#ifndef __STDC_WANT_DEC_FP__ #define __STDC_WANT_DEC_FP__ 1 +#endif + #include <float.h> extern void abort (void); diff --git a/libdecnumber/ChangeLog b/libdecnumber/ChangeLog index 5f84c40..fff1fb3 100644 --- a/libdecnumber/ChangeLog +++ b/libdecnumber/ChangeLog @@ -1,3 +1,60 @@ +2007-03-23 Michael Meissner <michael.meissner@amd.com> + H.J. Lu <hongjiu.lu@intel.com> + Marius Cornea <marius.cornea@intel.com> + + * Makefile.in (enable_decimal_float): New. + (libdecnumber_a_OBJS): Add bid2dpd_dpd2bid.o, host-ieee32.o, + host-ieee64.o and host-ieee128.o for BID. + (libdecnumber_a_SOURCES): Support DPD and BID. + (decimal32.o): Support dependency for both DPD and BID. + (decimal64.o): Likewise. + (decimal128.o): Likewise. + (bid2dpd_dpd2bid.o): New target. + (host-ieee32.o): Likewise. + (host-ieee64.o): Likewise. + (host-ieee128.o): Likewise. + + * bid/bid-dpd.h: New file. + * bid/decimal128.c: Likewise. + * bid/decimal128.h: Likewise. + * bid/decimal32.c: Likewise. + * bid/decimal32.h: Likewise. + * bid/decimal64.c: Likewise. + * bid/decimal64.h: Likewise. + * bid/host-ieee128.c: Likewise. + * bid/host-ieee32.c: Likewise. + * bid/host-ieee64.c: Likewise. + * bid/bid2dpd_dpd2bid.c: Likewise. + * bid/bid2dpd_dpd2bid.h: Likewise. + + * decimal128.c: Moved to ... + * dpd/decimal128.c: This. + * decimal128.h: Moved to ... + * dpd/decimal128.h: This. + * decimal32.c: Moved to ... + * dpd/decimal32.c: This. + * decimal32.h: Moved to ... + * dpd/decimal32.h: This. + * decimal64.c: Moved to ... + * dpd/decimal64.c: This. + * decimal64.h: Moved to ... + * dpd/decimal64.h: This. + + * configure.ac: Support * --enable-decimal-float={no,yes,bid,dpd}. + Add AC_C_BIGENDIAN. Substitute enable_decimal_float. + * config.in: Add decimal support variables. + * configure: Regenerate. + + PR other/30530 + * decimal128.h (decimal128ClearSign): New. + (decimal128FlipSign): Likewise. + + * decimal32.h: (decimal32ClearSign): New. + (decimal32FlipSign): Likewise. + + * decimal64.h (decimal64ClearSign): New. + (decimal64FlipSign): Likewise. + 2007-03-08 Ben Elliston <bje@au.ibm.com> * decContext.c, decContext.h, decDPD.h, decimal128.c, diff --git a/libdecnumber/Makefile.in b/libdecnumber/Makefile.in index 899a1b5..caa5f7d 100644 --- a/libdecnumber/Makefile.in +++ b/libdecnumber/Makefile.in @@ -1,7 +1,7 @@ # @configure_input@ # Makefile for libdecnumber. Run 'configure' to generate Makefile from Makefile.in -# Copyright (C) 2005 Free Software Foundation, Inc. +# Copyright (C) 2005, 2007 Free Software Foundation, Inc. #This file is part of GCC. @@ -50,6 +50,8 @@ libdir = @libdir@ localedir = $(datadir)/locale prefix = @prefix@ +enable_decimal_float= @enable_decimal_float@ + INCLUDES = -I$(srcdir) -I. ALL_CFLAGS = $(CFLAGS) $(WARN_CFLAGS) $(INCLUDES) $(CPPFLAGS) @@ -57,11 +59,20 @@ ALL_CFLAGS = $(CFLAGS) $(WARN_CFLAGS) $(INCLUDES) $(CPPFLAGS) libdecnumber_a_OBJS = decNumber.o decContext.o decUtility.o \ decimal32.o decimal64.o decimal128.o +ifeq ($(enable_decimal_float),bid) +libdecnumber_a_OBJS+=bid2dpd_dpd2bid.o host-ieee32.o host-ieee64.o \ + host-ieee128.o +endif + libdecnumber_a_SOURCES = decContext.c decContext.h decDPD.h \ decNumber.c decNumber.h decNumberLocal.h \ decUtility.c decUtility.h \ - decimal128.c decimal128.h decimal32.c decimal32.h \ - decimal64.c decimal64.h + dpd/decimal128.c dpd/decimal128.h \ + dpd/decimal32.c dpd/decimal32.h \ + dpd/decimal64.c dpd/decimal64.h \ + bid/decimal128.c bid/decimal128.h \ + bid/decimal32.c bid/decimal32.h \ + bid/decimal64.c bid/decimal64.h all: libdecnumber.a @@ -104,13 +115,26 @@ $(srcdir)/config.in: @MAINT@ $(srcdir)/configure decContext.o: decContext.c decContext.h decNumberLocal.h decNumber.o: decNumber.c decNumber.h decContext.h decNumberLocal.h -decimal32.o: decimal32.c decNumber.h decContext.h decNumberLocal.h \ - decimal32.h decUtility.h -decimal64.o: decimal64.c decNumber.h decContext.h decNumberLocal.h \ - decimal64.h decUtility.h -decimal128.o: decimal128.c decNumber.h decNumberLocal.h decimal128.h \ - decUtility.h - +decimal32.o: $(enable_decimal_float)/decimal32.c \ + $(enable_decimal_float)/decimal32.h \ + decNumber.h decContext.h decNumberLocal.h decUtility.h + $(COMPILE) $< +decimal64.o: $(enable_decimal_float)/decimal64.c \ + $(enable_decimal_float)/decimal64.h \ + decNumber.h decContext.h decNumberLocal.h decUtility.h + $(COMPILE) $< +decimal128.o: $(enable_decimal_float)/decimal128.c \ + $(enable_decimal_float)/decimal128.h \ + decNumber.h decContext.h decNumberLocal.h decUtility.h + $(COMPILE) $< +bid2dpd_dpd2bid.o : bid/bid2dpd_dpd2bid.c bid/bid2dpd_dpd2bid.h + $(COMPILE) $< +host-ieee32.o : bid/host-ieee32.c bid/decimal32.h + $(COMPILE) $< +host-ieee64.o : bid/host-ieee64.c bid/decimal64.h + $(COMPILE) $< +host-ieee128.o : bid/host-ieee128.c bid/decimal128.h + $(COMPILE) $< # Other miscellaneous targets. mostlyclean: diff --git a/libdecnumber/bid/bid-dpd.h b/libdecnumber/bid/bid-dpd.h new file mode 100644 index 0000000..d8bf327 --- /dev/null +++ b/libdecnumber/bid/bid-dpd.h @@ -0,0 +1,43 @@ +/* Copyright (C) 2007 + Free Software Foundation, Inc. + +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. */ + +/* As a special exception, if you link this library with other files, + some of which are compiled with GCC, to produce an executable, + this library does not by itself cause the resulting executable + to be covered by the GNU General Public License. + This exception does not however invalidate any other reasons why + the executable file might be covered by the GNU General Public License. */ + +typedef unsigned int UINT32; +typedef unsigned long long UINT64; +typedef struct { UINT64 w[2]; } UINT128; + +#ifndef IN_LIBGCC2 +#define _Decimal32 UINT32 +#define _Decimal64 UINT64 +#define _Decimal128 UINT128 +#endif + +void _bid_to_dpd32 (_Decimal32 *, _Decimal32 *); +void _dpd_to_bid32 (_Decimal32 *, _Decimal32 *); +void _bid_to_dpd64 (_Decimal64 *, _Decimal64 *); +void _dpd_to_bid64 (_Decimal64 *, _Decimal64 *); +void _bid_to_dpd128 (_Decimal128 *, _Decimal128 *); +void _dpd_to_bid128 (_Decimal128 *, _Decimal128 *); diff --git a/libdecnumber/bid/bid2dpd_dpd2bid.c b/libdecnumber/bid/bid2dpd_dpd2bid.c new file mode 100644 index 0000000..01e83bc --- /dev/null +++ b/libdecnumber/bid/bid2dpd_dpd2bid.c @@ -0,0 +1,428 @@ +/* Copyright (C) 2007 Free Software Foundation, Inc. + +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. + +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file into combinations with other programs, +and to distribute those combinations without any restriction coming +from the use of this file. (The General Public License restrictions +do apply in other respects; for example, they cover modification of +the file, and distribution when not linked into a combine +executable.) + +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. */ + +#undef IN_LIBGCC2 +#include "bid-dpd.h" + +/* get full 64x64bit product */ +#define __mul_64x64_to_128(P, CX, CY) \ +{ \ + UINT64 CXH, CXL, CYH,CYL,PL,PH,PM,PM2; \ + CXH = (CX) >> 32; \ + CXL = (UINT32)(CX); \ + CYH = (CY) >> 32; \ + CYL = (UINT32)(CY); \ + \ + PM = CXH*CYL; \ + PH = CXH*CYH; \ + PL = CXL*CYL; \ + PM2 = CXL*CYH; \ + PH += (PM>>32); \ + PM = (UINT64)((UINT32)PM)+PM2+(PL>>32); \ + \ + (P).w[1] = PH + (PM>>32); \ + (P).w[0] = (PM<<32)+(UINT32)PL; \ +} + +/* add 64-bit value to 128-bit */ +#define __add_128_64(R128, A128, B64) \ +{ \ + UINT64 R64H; \ + R64H = (A128).w[1]; \ + (R128).w[0] = (B64) + (A128).w[0]; \ + if((R128).w[0] < (B64)) R64H ++; \ + (R128).w[1] = R64H; \ +} + +/* add 128-bit value to 128-bit (assume no carry-out) */ +#define __add_128_128(R128, A128, B128) \ +{ \ + UINT128 Q128; \ + Q128.w[1] = (A128).w[1]+(B128).w[1]; \ + Q128.w[0] = (B128).w[0] + (A128).w[0]; \ + if(Q128.w[0] < (B128).w[0]) Q128.w[1] ++; \ + (R128).w[1] = Q128.w[1]; \ + (R128).w[0] = Q128.w[0]; \ +} + +#define __mul_128x128_high(Q, A, B) \ +{ \ + UINT128 ALBL, ALBH, AHBL, AHBH, QM, QM2; \ + \ + __mul_64x64_to_128(ALBH, (A).w[0], (B).w[1]); \ + __mul_64x64_to_128(AHBL, (B).w[0], (A).w[1]); \ + __mul_64x64_to_128(ALBL, (A).w[0], (B).w[0]); \ + __mul_64x64_to_128(AHBH, (A).w[1],(B).w[1]); \ + \ + __add_128_128(QM, ALBH, AHBL); \ + __add_128_64(QM2, QM, ALBL.w[1]); \ + __add_128_64((Q), AHBH, QM2.w[1]); \ +} + +#include "bid2dpd_dpd2bid.h" + +static const unsigned int dm103[] = + { 0, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 11000 }; + +void _bid_to_dpd32 (_Decimal32 *, _Decimal32 *); + +void +_bid_to_dpd32 (_Decimal32 *pres, _Decimal32 *px) { + unsigned int sign, coefficient_x, exp, dcoeff; + unsigned int b2, b1, b0, b01, res; + _Decimal32 x = *px; + + sign = (x & 0x80000000); + if ((x & 0x60000000ul) == 0x60000000ul) { + /* special encodings */ + if ((x & 0x78000000ul) == 0x78000000ul) { + *pres = x; /* NaN or Infinity */ + return; + } + /* coefficient */ + coefficient_x = (x & 0x001ffffful) | 0x00800000ul; + if (coefficient_x >= 10000000) coefficient_x = 0; + /* get exponent */ + exp = (x >> 21) & 0xff; + } else { + exp = (x >> 23) & 0xff; + coefficient_x = (x & 0x007ffffful); + } + b01 = coefficient_x / 1000; + b2 = coefficient_x - 1000 * b01; + b0 = b01 / 1000; + b1 = b01 - 1000 * b0; + dcoeff = b2d[b2] | b2d2[b1]; + if (b0 >= 8) { /* is b0 8 or 9? */ + res = sign | ((0x600 | ((exp >> 6) << 7) | + ((b0 & 1) << 6) | (exp & 0x3f)) << 20) | dcoeff; + } else { /* else b0 is 0..7 */ + res = sign | ((((exp >> 6) << 9) | (b0 << 6) | + (exp & 0x3f)) << 20) | dcoeff; + } + *pres = res; +} + +void _dpd_to_bid32 (_Decimal32 *, _Decimal32 *); + +void +_dpd_to_bid32 (_Decimal32 *pres, _Decimal32 *px) { + unsigned int r; + unsigned int sign, exp, bcoeff; + UINT64 trailing; + unsigned int d0, d1, d2; + _Decimal32 x = *px; + + sign = (x & 0x80000000); + trailing = (x & 0x000fffff); + if ((x & 0x78000000) == 0x78000000) { + *pres = x; + return; + } else { /* normal number */ + if ((x & 0x60000000) == 0x60000000) { /* G0..G1 = 11 -> d0 = 8 + G4 */ + d0 = d2b3[((x >> 26) & 1) | 8]; /* d0 = (comb & 0x0100 ? 9 : 8); */ + exp = (x >> 27) & 3; /* exp leading bits are G2..G3 */ + } else { + d0 = d2b3[(x >> 26) & 0x7]; + exp = (x >> 29) & 3; /* exp loading bits are G0..G1 */ + } + d1 = d2b2[(trailing >> 10) & 0x3ff]; + d2 = d2b[(trailing) & 0x3ff]; + bcoeff = d2 + d1 + d0; + exp = (exp << 6) + ((x >> 20) & 0x3f); + if (bcoeff < (1 << 23)) { + r = exp; + r <<= 23; + r |= (bcoeff | sign); + } else { + r = exp; + r <<= 21; + r |= (sign | 0x60000000ul); + /* add coeff, without leading bits */ + r |= (((unsigned int) bcoeff) & 0x1fffff); + } + } + *pres = r; +} + +void _bid_to_dpd64 (_Decimal64 *, _Decimal64 *); + +void +_bid_to_dpd64 (_Decimal64 *pres, _Decimal64 *px) { + UINT64 res; + UINT64 sign, comb, exp, B34, B01; + UINT64 d103, D61; + UINT64 b0, b2, b3, b5; + unsigned int b1, b4; + UINT64 bcoeff; + UINT64 dcoeff; + unsigned int yhi, ylo; + _Decimal64 x = *px; + + sign = (x & 0x8000000000000000ull); + comb = (x & 0x7ffc000000000000ull) >> 51; + if ((comb & 0xf00) == 0xf00) { + *pres = x; + return; + } else { /* Normal number */ + if ((comb & 0xc00) == 0xc00) { /* G0..G1 = 11 -> exp is G2..G11 */ + exp = (comb) & 0x3ff; + bcoeff = (x & 0x0007ffffffffffffull) | 0x0020000000000000ull; + } else { + exp = (comb >> 2) & 0x3ff; + bcoeff = (x & 0x001fffffffffffffull); + } + D61 = 2305843009ull; /* Floor(2^61 / 10^9) */ + /* Multiply the binary coefficient by ceil(2^64 / 1000), and take the upper + 64-bits in order to compute a division by 1000. */ + yhi = (D61 * (UINT64)(bcoeff >> (UINT64)27)) >> (UINT64)34; + ylo = bcoeff - 1000000000ull * yhi; + if (ylo >= 1000000000) { + ylo = ylo - 1000000000; + yhi = yhi + 1; + } + d103 = 0x4189374c; + B34 = ((UINT64) ylo * d103) >> (32 + 8); + B01 = ((UINT64) yhi * d103) >> (32 + 8); + b5 = ylo - B34 * 1000; + b2 = yhi - B01 * 1000; + b3 = ((UINT64) B34 * d103) >> (32 + 8); + b0 = ((UINT64) B01 * d103) >> (32 + 8); + b4 = (unsigned int) B34 - (unsigned int) b3 *1000; + b1 = (unsigned int) B01 - (unsigned int) dm103[b0]; + dcoeff = b2d[b5] | b2d2[b4] | b2d3[b3] | b2d4[b2] | b2d5[b1]; + if (b0 >= 8) /* is b0 8 or 9? */ + res = sign | ((0x1800 | ((exp >> 8) << 9) | ((b0 & 1) << 8) | + (exp & 0xff)) << 50) | dcoeff; + else /* else b0 is 0..7 */ + res = sign | ((((exp >> 8) << 11) | (b0 << 8) | + (exp & 0xff)) << 50) | dcoeff; + } + *pres = res; +} + +void _dpd_to_bid64 (_Decimal64 *, _Decimal64 *); + +void +_dpd_to_bid64 (_Decimal64 *pres, _Decimal64 *px) { + UINT64 res; + UINT64 sign, comb, exp; + UINT64 trailing; + UINT64 d0, d1, d2; + unsigned int d3, d4, d5; + UINT64 bcoeff, mask; + _Decimal64 x = *px; + + sign = (x & 0x8000000000000000ull); + comb = (x & 0x7ffc000000000000ull) >> 50; + trailing = (x & 0x0003ffffffffffffull); + if ((comb & 0x1e00) == 0x1e00) { + if ((comb & 0x1f00) == 0x1f00) { /* G0..G4 = 11111 -> NaN */ + if (comb & 0x0100) { /* G5 = 1 -> sNaN */ + *pres = x; + } else { /* G5 = 0 -> qNaN */ + *pres = x; + } + } else { /*if ((comb & 0x1e00) == 0x1e00); G0..G4 = 11110 -> INF */ + *pres = x; + } + return; + } else { /* normal number */ + if ((comb & 0x1800) == 0x1800) { /* G0..G1 = 11 -> d0 = 8 + G4 */ + d0 = d2b6[((comb >> 8) & 1) | 8]; /* d0 = (comb & 0x0100 ? 9 : 8); */ + exp = (comb & 0x600) >> 1; /* exp = (comb & 0x0400 ? 1 : 0) * 0x200 + + (comb & 0x0200 ? 1 : 0) * 0x100; exp leading bits are G2..G3 */ + } else { + d0 = d2b6[(comb >> 8) & 0x7]; + exp = (comb & 0x1800) >> 3; /* exp = (comb & 0x1000 ? 1 : 0) * 0x200 + + (comb & 0x0800 ? 1 : 0) * 0x100; exp loading bits are G0..G1 */ + } + d1 = d2b5[(trailing >> 40) & 0x3ff]; + d2 = d2b4[(trailing >> 30) & 0x3ff]; + d3 = d2b3[(trailing >> 20) & 0x3ff]; + d4 = d2b2[(trailing >> 10) & 0x3ff]; + d5 = d2b[(trailing) & 0x3ff]; + bcoeff = (d5 + d4 + d3) + d2 + d1 + d0; + exp += (comb & 0xff); + mask = 1; + mask <<= 53; + if (bcoeff < mask) { /* check whether coefficient fits in 10*5+3 bits */ + res = exp; + res <<= 53; + res |= (bcoeff | sign); + *pres = res; + return; + } + /* special format */ + res = (exp << 51) | (sign | 0x6000000000000000ull); + /* add coeff, without leading bits */ + mask = (mask >> 2) - 1; + bcoeff &= mask; + res |= bcoeff; + } + *pres = res; +} + +void _bid_to_dpd128 (_Decimal128 *, _Decimal128 *); + +void +_bid_to_dpd128 (_Decimal128 *pres, _Decimal128 *px) { + UINT128 res; + UINT128 sign; + unsigned int comb; + UINT128 bcoeff; + UINT128 dcoeff; + UINT128 BH, d1018, BT2, BT1; + UINT64 exp, BL, d109; + UINT64 d106, d103; + UINT64 k1, k2, k4, k5, k7, k8, k10, k11; + unsigned int BHH32, BLL32, BHL32, BLH32, k0, k3, k6, k9, amount; + _Decimal128 x = *px; + + sign.w[1] = (x.w[1] & 0x8000000000000000ull); + sign.w[0] = 0; + comb = (x.w[1] /*& 0x7fffc00000000000ull */ ) >> 46; + exp = 0; + if ((comb & 0x1e000) == 0x1e000) { + if ((comb & 0x1f000) == 0x1f000) { /* G0..G4 = 11111 -> NaN */ + if (comb & 0x01000) { /* G5 = 1 -> sNaN */ + res = x; + } else { /* G5 = 0 -> qNaN */ + res = x; + } + } else { /* G0..G4 = 11110 -> INF */ + res = x; + } + } else { /* normal number */ + exp = ((x.w[1] & 0x7fff000000000000ull) >> 49) & 0x3fff; + bcoeff.w[1] = (x.w[1] & 0x0001ffffffffffffull); + bcoeff.w[0] = x.w[0]; + d1018 = reciprocals10_128[18]; + __mul_128x128_high (BH, bcoeff, d1018); + amount = recip_scale[18]; + BH.w[0] = (BH.w[0] >> amount) | (BH.w[1] << (64 - amount)); + BL = bcoeff.w[0] - BH.w[0] * 1000000000000000000ull; + d109 = reciprocals10_64[9]; + __mul_64x64_to_128 (BT1, BH.w[0], d109); + BHH32 = (unsigned int) (BT1.w[1] >> short_recip_scale[9]); + BHL32 = (unsigned int) BH.w[0] - BHH32 * 1000000000; + __mul_64x64_to_128 (BT2, BL, d109); + BLH32 = (unsigned int) (BT2.w[1] >> short_recip_scale[9]); + BLL32 = (unsigned int) BL - BLH32 * 1000000000; + d106 = 0x431BDE83; + d103 = 0x4189374c; + k0 = ((UINT64) BHH32 * d106) >> (32 + 18); + BHH32 -= (unsigned int) k0 *1000000; + k1 = ((UINT64) BHH32 * d103) >> (32 + 8); + k2 = BHH32 - (unsigned int) k1 *1000; + k3 = ((UINT64) BHL32 * d106) >> (32 + 18); + BHL32 -= (unsigned int) k3 *1000000; + k4 = ((UINT64) BHL32 * d103) >> (32 + 8); + k5 = BHL32 - (unsigned int) k4 *1000; + k6 = ((UINT64) BLH32 * d106) >> (32 + 18); + BLH32 -= (unsigned int) k6 *1000000; + k7 = ((UINT64) BLH32 * d103) >> (32 + 8); + k8 = BLH32 - (unsigned int) k7 *1000; + k9 = ((UINT64) BLL32 * d106) >> (32 + 18); + BLL32 -= (unsigned int) k9 *1000000; + k10 = ((UINT64) BLL32 * d103) >> (32 + 8); + k11 = BLL32 - (unsigned int) k10 *1000; + dcoeff.w[1] = (b2d[k5] >> 4) | (b2d[k4] << 6) | (b2d[k3] << 16) | + (b2d[k2] << 26) | (b2d[k1] << 36); + dcoeff.w[0] = b2d[k11] | (b2d[k10] << 10) | (b2d[k9] << 20) | + (b2d[k8] << 30) | (b2d[k7] << 40) | (b2d[k6] << 50) | (b2d[k5] << 60); + res.w[0] = dcoeff.w[0]; + if (k0 >= 8) { + res.w[1] = sign.w[1] | ((0x18000 | ((exp >> 12) << 13) | + ((k0 & 1) << 12) | (exp & 0xfff)) << 46) | dcoeff.w[1]; + } else { + res.w[1] = sign.w[1] | ((((exp >> 12) << 15) | (k0 << 12) | + (exp & 0xfff)) << 46) | dcoeff.w[1]; + } + } + *pres = res; +} + +void _dpd_to_bid128 (_Decimal128 *, _Decimal128 *); + +void +_dpd_to_bid128 (_Decimal128 *pres, _Decimal128 *px) { + UINT128 res; + UINT128 sign; + UINT64 exp, comb; + UINT128 trailing; + UINT64 d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11; + UINT128 bcoeff; + UINT64 tl, th; + _Decimal128 x = *px; + + sign.w[1] = (x.w[1] & 0x8000000000000000ull); + sign.w[0] = 0; + comb = (x.w[1] & 0x7fffc00000000000ull) >> 46; + trailing.w[1] = x.w[1]; + trailing.w[0] = x.w[0]; + if ((comb & 0x1e000) == 0x1e000) { + if ((comb & 0x1f000) == 0x1f000) { /* G0..G4 = 11111 -> NaN */ + if (comb & 0x01000) { /* G5 = 1 -> sNaN */ + *pres = x; + } else { /* G5 = 0 -> qNaN */ + *pres = x; + } + } else { /* G0..G4 = 11110 -> INF */ + *pres = x; + } + return; + } else { /* Normal number */ + if ((comb & 0x18000) == 0x18000) { /* G0..G1 = 11 -> d0 = 8 + G4 */ + d0 = d2b6[8 + ((comb & 0x01000) >> 12)]; + exp = (comb & 0x06000) >> 1; /* exp leading bits are G2..G3 */ + } else { + d0 = d2b6[((comb & 0x07000) >> 12)]; + exp = (comb & 0x18000) >> 3; /* exp loading bits are G0..G1 */ + } + d11 = d2b[(trailing.w[0]) & 0x3ff]; + d10 = d2b2[(trailing.w[0] >> 10) & 0x3ff]; + d9 = d2b3[(trailing.w[0] >> 20) & 0x3ff]; + d8 = d2b4[(trailing.w[0] >> 30) & 0x3ff]; + d7 = d2b5[(trailing.w[0] >> 40) & 0x3ff]; + d6 = d2b6[(trailing.w[0] >> 50) & 0x3ff]; + d5 = d2b[(trailing.w[0] >> 60) | ((trailing.w[1] & 0x3f) << 4)]; + d4 = d2b2[(trailing.w[1] >> 6) & 0x3ff]; + d3 = d2b3[(trailing.w[1] >> 16) & 0x3ff]; + d2 = d2b4[(trailing.w[1] >> 26) & 0x3ff]; + d1 = d2b5[(trailing.w[1] >> 36) & 0x3ff]; + tl = d11 + d10 + d9 + d8 + d7 + d6; + th = d5 + d4 + d3 + d2 + d1 + d0; + __mul_64x64_to_128 (bcoeff, th, 1000000000000000000ull); + __add_128_64 (bcoeff, bcoeff, tl); + exp += (comb & 0xfff); + res.w[0] = bcoeff.w[0]; + res.w[1] = (exp << 49) | sign.w[1] | bcoeff.w[1]; + } + *pres = res; +} diff --git a/libdecnumber/bid/bid2dpd_dpd2bid.h b/libdecnumber/bid/bid2dpd_dpd2bid.h new file mode 100644 index 0000000..7728cff --- /dev/null +++ b/libdecnumber/bid/bid2dpd_dpd2bid.h @@ -0,0 +1,10407 @@ +/* Copyright (C) 2007 Free Software Foundation, Inc. + +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. + +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file into combinations with other programs, +and to distribute those combinations without any restriction coming +from the use of this file. (The General Public License restrictions +do apply in other respects; for example, they cover modification of +the file, and distribution when not linked into a combine +executable.) + +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. */ + +static const UINT128 reciprocals10_128[] = { + { { 0ull, 0ull } }, /* 0 extra digits */ + { { 0x3333333333333334ull ,0x3333333333333333ull } }, /* 1 extra digit */ + { { 0x51eb851eb851eb86ull ,0x051eb851eb851eb8ull } }, /* 2 extra digits */ + { { 0x3b645a1cac083127ull, 0x0083126e978d4fdfull } }, /* 3 extra digits */ + { { 0x4af4f0d844d013aaULL, 0x00346dc5d6388659ULL } }, /* 10^(-4) * 2^131 */ + { { 0x08c3f3e0370cdc88ULL, 0x0029f16b11c6d1e1ULL } }, /* 10^(-5) * 2^134 */ + { { 0x6d698fe69270b06dULL, 0x00218def416bdb1aULL } }, /* 10^(-6) * 2^137 */ + { { 0xaf0f4ca41d811a47ULL, 0x0035afe535795e90ULL } }, /* 10^(-7) * 2^141 */ + { { 0xbf3f70834acdaea0ULL, 0x002af31dc4611873ULL } }, /* 10^(-8) * 2^144 */ + { { 0x65cc5a02a23e254dULL, 0x00225c17d04dad29ULL } }, /* 10^(-9) * 2^147 */ + { { 0x6fad5cd10396a214ULL, 0x0036f9bfb3af7b75ULL } }, /* 10^(-10) * 2^151 */ + { { 0xbfbde3da69454e76ULL, 0x002bfaffc2f2c92aULL } }, /* 10^(-11) * 2^154 */ + { { 0x32fe4fe1edd10b92ULL, 0x00232f33025bd422ULL } }, /* 10^(-12) * 2^157 */ + { { 0x84ca19697c81ac1cULL, 0x00384b84d092ed03ULL } }, /* 10^(-13) * 2^161 */ + { { 0x03d4e1213067bce4ULL, 0x002d09370d425736ULL } }, /* 10^(-14) * 2^164 */ + { { 0x3643e74dc052fd83ULL, 0x0024075f3dceac2bULL } }, /* 10^(-15) * 2^167 */ + { { 0x56d30baf9a1e626bULL, 0x0039a5652fb11378ULL } }, /* 10^(-16) * 2^171 */ + { { 0x12426fbfae7eb522ULL, 0x002e1dea8c8da92dULL } }, /* 10^(-17) * 2^174 */ + { { 0x41cebfcc8b9890e8ULL, 0x0024e4bba3a48757ULL } }, /* 10^(-18) * 2^177 */ + { { 0x694acc7a78f41b0dULL, 0x003b07929f6da558ULL } }, /* 10^(-19) * 2^181 */ + { { 0xbaa23d2ec729af3eULL, 0x002f394219248446ULL } }, /* 10^(-20) * 2^184 */ + { { 0xfbb4fdbf05baf298ULL, 0x0025c768141d369eULL } }, /* 10^(-21) * 2^187 */ + { { 0x2c54c931a2c4b759ULL, 0x003c7240202ebdcbULL } }, /* 10^(-22) * 2^191 */ + { { 0x89dd6dc14f03c5e1ULL, 0x00305b66802564a2ULL } }, /* 10^(-23) * 2^194 */ + { { 0xd4b1249aa59c9e4eULL, 0x0026af8533511d4eULL } }, /* 10^(-24) * 2^197 */ + { { 0x544ea0f76f60fd49ULL, 0x003de5a1ebb4fbb1ULL } }, /* 10^(-25) * 2^201 */ + { { 0x76a54d92bf80caa1ULL, 0x00318481895d9627ULL } }, /* 10^(-26) * 2^204 */ + { { 0x921dd7a89933d54eULL, 0x00279d346de4781fULL } }, /* 10^(-27) * 2^207 */ + { { 0x8362f2a75b862215ULL, 0x003f61ed7ca0c032ULL } }, /* 10^(-28) * 2^211 */ + { { 0xcf825bb91604e811ULL, 0x0032b4bdfd4d668eULL } }, /* 10^(-29) * 2^214 */ + { { 0x0c684960de6a5341ULL, 0x00289097fdd7853fULL } }, /* 10^(-30) * 2^217 */ + { { 0x3d203ab3e521dc34ULL, 0x002073accb12d0ffULL } }, /* 10^(-31) * 2^220 */ + { { 0x2e99f7863b696053ULL, 0x0033ec47ab514e65ULL } }, /* 10^(-32) * 2^224 */ + { { 0x587b2c6b62bab376ULL, 0x002989d2ef743eb7ULL } }, /* 10^(-33) * 2^227 */ + { { 0xad2f56bc4efbc2c5ULL, 0x00213b0f25f69892ULL } }, /* 10^(-34) * 2^230 */ + { { 0x0f2abc9d8c9689d1ull, 0x01a95a5b7f87a0efull } } /* 35 extra digits */ +}; + +static const int recip_scale[] = { + 129 - 128, /* 1 */ + 129 - 128, /* 1/10 */ + 129 - 128, /* 1/10^2 */ + 129 - 128, /* 1/10^3 */ + 3, /* 131 - 128 */ + 6, /* 134 - 128 */ + 9, /* 137 - 128 */ + 13, /* 141 - 128 */ + 16, /* 144 - 128 */ + 19, /* 147 - 128 */ + 23, /* 151 - 128 */ + 26, /* 154 - 128 */ + 29, /* 157 - 128 */ + 33, /* 161 - 128 */ + 36, /* 164 - 128 */ + 39, /* 167 - 128 */ + 43, /* 171 - 128 */ + 46, /* 174 - 128 */ + 49, /* 177 - 128 */ + 53, /* 181 - 128 */ + 56, /* 184 - 128 */ + 59, /* 187 - 128 */ + 63, /* 191 - 128 */ + + 66, /* 194 - 128 */ + 69, /* 197 - 128 */ + 73, /* 201 - 128 */ + 76, /* 204 - 128 */ + 79, /* 207 - 128 */ + 83, /* 211 - 128 */ + 86, /* 214 - 128 */ + 89, /* 217 - 128 */ + 92, /* 220 - 128 */ + 96, /* 224 - 128 */ + 99, /* 227 - 128 */ + 102, /* 230 - 128 */ + 237 - 128, /* 1/10^35 */ +}; + +static const int short_recip_scale[] = { + 1, + 65 - 64, + 69 - 64, + 71 - 64, + 75 - 64, + 78 - 64, + 81 - 64, + 85 - 64, + 88 - 64, + 91 - 64, + 95 - 64, + 98 - 64, + 101 - 64, + 105 - 64, + 108 - 64, + 111 - 64, + 115 - 64, /* 114 - 64 */ + 118 - 64 +}; + +static const unsigned long long reciprocals10_64[] = { + 1ull, /* dummy value for 0 extra digits */ + 0x3333333333333334ull, /* 1 extra digit */ + 0x51eb851eb851eb86ull, + 0x20c49ba5e353f7cfull, + 0x346dc5d63886594bull, + 0x29f16b11c6d1e109ull, + 0x218def416bdb1a6eull, + 0x35afe535795e90b0ull, + 0x2af31dc4611873c0ull, + 0x225c17d04dad2966ull, + 0x36f9bfb3af7b7570ull, + 0x2bfaffc2f2c92ac0ull, + 0x232f33025bd42233ull, + 0x384b84d092ed0385ull, + 0x2d09370d42573604ull, + 0x24075f3dceac2b37ull, + 0x39a5652fb1137857ull, + 0x2e1dea8c8da92d13ull +}; + +static const UINT64 d2b[] = { + 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 }; + +static const UINT64 d2b2[] = { + 0000ull, 1000ull, 2000ull, 3000ull, + 4000ull, 5000ull, 6000ull, 7000ull, + 8000ull, 9000ull, 80000ull, 81000ull, + 800000ull, 801000ull, 880000ull, 881000ull, + 10000ull, 11000ull, 12000ull, 13000ull, + 14000ull, 15000ull, 16000ull, 17000ull, + 18000ull, 19000ull, 90000ull, 91000ull, + 810000ull, 811000ull, 890000ull, 891000ull, + 20000ull, 21000ull, 22000ull, 23000ull, + 24000ull, 25000ull, 26000ull, 27000ull, + 28000ull, 29000ull, 82000ull, 83000ull, + 820000ull, 821000ull, 808000ull, 809000ull, + 30000ull, 31000ull, 32000ull, 33000ull, + 34000ull, 35000ull, 36000ull, 37000ull, + 38000ull, 39000ull, 92000ull, 93000ull, + 830000ull, 831000ull, 818000ull, 819000ull, + 40000ull, 41000ull, 42000ull, 43000ull, + 44000ull, 45000ull, 46000ull, 47000ull, + 48000ull, 49000ull, 84000ull, 85000ull, + 840000ull, 841000ull, 88000ull, 89000ull, + 50000ull, 51000ull, 52000ull, 53000ull, + 54000ull, 55000ull, 56000ull, 57000ull, + 58000ull, 59000ull, 94000ull, 95000ull, + 850000ull, 851000ull, 98000ull, 99000ull, + 60000ull, 61000ull, 62000ull, 63000ull, + 64000ull, 65000ull, 66000ull, 67000ull, + 68000ull, 69000ull, 86000ull, 87000ull, + 860000ull, 861000ull, 888000ull, 889000ull, + 70000ull, 71000ull, 72000ull, 73000ull, + 74000ull, 75000ull, 76000ull, 77000ull, + 78000ull, 79000ull, 96000ull, 97000ull, + 870000ull, 871000ull, 898000ull, 899000ull, + 100000ull, 101000ull, 102000ull, 103000ull, + 104000ull, 105000ull, 106000ull, 107000ull, + 108000ull, 109000ull, 180000ull, 181000ull, + 900000ull, 901000ull, 980000ull, 981000ull, + 110000ull, 111000ull, 112000ull, 113000ull, + 114000ull, 115000ull, 116000ull, 117000ull, + 118000ull, 119000ull, 190000ull, 191000ull, + 910000ull, 911000ull, 990000ull, 991000ull, + 120000ull, 121000ull, 122000ull, 123000ull, + 124000ull, 125000ull, 126000ull, 127000ull, + 128000ull, 129000ull, 182000ull, 183000ull, + 920000ull, 921000ull, 908000ull, 909000ull, + 130000ull, 131000ull, 132000ull, 133000ull, + 134000ull, 135000ull, 136000ull, 137000ull, + 138000ull, 139000ull, 192000ull, 193000ull, + 930000ull, 931000ull, 918000ull, 919000ull, + 140000ull, 141000ull, 142000ull, 143000ull, + 144000ull, 145000ull, 146000ull, 147000ull, + 148000ull, 149000ull, 184000ull, 185000ull, + 940000ull, 941000ull, 188000ull, 189000ull, + 150000ull, 151000ull, 152000ull, 153000ull, + 154000ull, 155000ull, 156000ull, 157000ull, + 158000ull, 159000ull, 194000ull, 195000ull, + 950000ull, 951000ull, 198000ull, 199000ull, + 160000ull, 161000ull, 162000ull, 163000ull, + 164000ull, 165000ull, 166000ull, 167000ull, + 168000ull, 169000ull, 186000ull, 187000ull, + 960000ull, 961000ull, 988000ull, 989000ull, + 170000ull, 171000ull, 172000ull, 173000ull, + 174000ull, 175000ull, 176000ull, 177000ull, + 178000ull, 179000ull, 196000ull, 197000ull, + 970000ull, 971000ull, 998000ull, 999000ull, + 200000ull, 201000ull, 202000ull, 203000ull, + 204000ull, 205000ull, 206000ull, 207000ull, + 208000ull, 209000ull, 280000ull, 281000ull, + 802000ull, 803000ull, 882000ull, 883000ull, + 210000ull, 211000ull, 212000ull, 213000ull, + 214000ull, 215000ull, 216000ull, 217000ull, + 218000ull, 219000ull, 290000ull, 291000ull, + 812000ull, 813000ull, 892000ull, 893000ull, + 220000ull, 221000ull, 222000ull, 223000ull, + 224000ull, 225000ull, 226000ull, 227000ull, + 228000ull, 229000ull, 282000ull, 283000ull, + 822000ull, 823000ull, 828000ull, 829000ull, + 230000ull, 231000ull, 232000ull, 233000ull, + 234000ull, 235000ull, 236000ull, 237000ull, + 238000ull, 239000ull, 292000ull, 293000ull, + 832000ull, 833000ull, 838000ull, 839000ull, + 240000ull, 241000ull, 242000ull, 243000ull, + 244000ull, 245000ull, 246000ull, 247000ull, + 248000ull, 249000ull, 284000ull, 285000ull, + 842000ull, 843000ull, 288000ull, 289000ull, + 250000ull, 251000ull, 252000ull, 253000ull, + 254000ull, 255000ull, 256000ull, 257000ull, + 258000ull, 259000ull, 294000ull, 295000ull, + 852000ull, 853000ull, 298000ull, 299000ull, + 260000ull, 261000ull, 262000ull, 263000ull, + 264000ull, 265000ull, 266000ull, 267000ull, + 268000ull, 269000ull, 286000ull, 287000ull, + 862000ull, 863000ull, 888000ull, 889000ull, + 270000ull, 271000ull, 272000ull, 273000ull, + 274000ull, 275000ull, 276000ull, 277000ull, + 278000ull, 279000ull, 296000ull, 297000ull, + 872000ull, 873000ull, 898000ull, 899000ull, + 300000ull, 301000ull, 302000ull, 303000ull, + 304000ull, 305000ull, 306000ull, 307000ull, + 308000ull, 309000ull, 380000ull, 381000ull, + 902000ull, 903000ull, 982000ull, 983000ull, + 310000ull, 311000ull, 312000ull, 313000ull, + 314000ull, 315000ull, 316000ull, 317000ull, + 318000ull, 319000ull, 390000ull, 391000ull, + 912000ull, 913000ull, 992000ull, 993000ull, + 320000ull, 321000ull, 322000ull, 323000ull, + 324000ull, 325000ull, 326000ull, 327000ull, + 328000ull, 329000ull, 382000ull, 383000ull, + 922000ull, 923000ull, 928000ull, 929000ull, + 330000ull, 331000ull, 332000ull, 333000ull, + 334000ull, 335000ull, 336000ull, 337000ull, + 338000ull, 339000ull, 392000ull, 393000ull, + 932000ull, 933000ull, 938000ull, 939000ull, + 340000ull, 341000ull, 342000ull, 343000ull, + 344000ull, 345000ull, 346000ull, 347000ull, + 348000ull, 349000ull, 384000ull, 385000ull, + 942000ull, 943000ull, 388000ull, 389000ull, + 350000ull, 351000ull, 352000ull, 353000ull, + 354000ull, 355000ull, 356000ull, 357000ull, + 358000ull, 359000ull, 394000ull, 395000ull, + 952000ull, 953000ull, 398000ull, 399000ull, + 360000ull, 361000ull, 362000ull, 363000ull, + 364000ull, 365000ull, 366000ull, 367000ull, + 368000ull, 369000ull, 386000ull, 387000ull, + 962000ull, 963000ull, 988000ull, 989000ull, + 370000ull, 371000ull, 372000ull, 373000ull, + 374000ull, 375000ull, 376000ull, 377000ull, + 378000ull, 379000ull, 396000ull, 397000ull, + 972000ull, 973000ull, 998000ull, 999000ull, + 400000ull, 401000ull, 402000ull, 403000ull, + 404000ull, 405000ull, 406000ull, 407000ull, + 408000ull, 409000ull, 480000ull, 481000ull, + 804000ull, 805000ull, 884000ull, 885000ull, + 410000ull, 411000ull, 412000ull, 413000ull, + 414000ull, 415000ull, 416000ull, 417000ull, + 418000ull, 419000ull, 490000ull, 491000ull, + 814000ull, 815000ull, 894000ull, 895000ull, + 420000ull, 421000ull, 422000ull, 423000ull, + 424000ull, 425000ull, 426000ull, 427000ull, + 428000ull, 429000ull, 482000ull, 483000ull, + 824000ull, 825000ull, 848000ull, 849000ull, + 430000ull, 431000ull, 432000ull, 433000ull, + 434000ull, 435000ull, 436000ull, 437000ull, + 438000ull, 439000ull, 492000ull, 493000ull, + 834000ull, 835000ull, 858000ull, 859000ull, + 440000ull, 441000ull, 442000ull, 443000ull, + 444000ull, 445000ull, 446000ull, 447000ull, + 448000ull, 449000ull, 484000ull, 485000ull, + 844000ull, 845000ull, 488000ull, 489000ull, + 450000ull, 451000ull, 452000ull, 453000ull, + 454000ull, 455000ull, 456000ull, 457000ull, + 458000ull, 459000ull, 494000ull, 495000ull, + 854000ull, 855000ull, 498000ull, 499000ull, + 460000ull, 461000ull, 462000ull, 463000ull, + 464000ull, 465000ull, 466000ull, 467000ull, + 468000ull, 469000ull, 486000ull, 487000ull, + 864000ull, 865000ull, 888000ull, 889000ull, + 470000ull, 471000ull, 472000ull, 473000ull, + 474000ull, 475000ull, 476000ull, 477000ull, + 478000ull, 479000ull, 496000ull, 497000ull, + 874000ull, 875000ull, 898000ull, 899000ull, + 500000ull, 501000ull, 502000ull, 503000ull, + 504000ull, 505000ull, 506000ull, 507000ull, + 508000ull, 509000ull, 580000ull, 581000ull, + 904000ull, 905000ull, 984000ull, 985000ull, + 510000ull, 511000ull, 512000ull, 513000ull, + 514000ull, 515000ull, 516000ull, 517000ull, + 518000ull, 519000ull, 590000ull, 591000ull, + 914000ull, 915000ull, 994000ull, 995000ull, + 520000ull, 521000ull, 522000ull, 523000ull, + 524000ull, 525000ull, 526000ull, 527000ull, + 528000ull, 529000ull, 582000ull, 583000ull, + 924000ull, 925000ull, 948000ull, 949000ull, + 530000ull, 531000ull, 532000ull, 533000ull, + 534000ull, 535000ull, 536000ull, 537000ull, + 538000ull, 539000ull, 592000ull, 593000ull, + 934000ull, 935000ull, 958000ull, 959000ull, + 540000ull, 541000ull, 542000ull, 543000ull, + 544000ull, 545000ull, 546000ull, 547000ull, + 548000ull, 549000ull, 584000ull, 585000ull, + 944000ull, 945000ull, 588000ull, 589000ull, + 550000ull, 551000ull, 552000ull, 553000ull, + 554000ull, 555000ull, 556000ull, 557000ull, + 558000ull, 559000ull, 594000ull, 595000ull, + 954000ull, 955000ull, 598000ull, 599000ull, + 560000ull, 561000ull, 562000ull, 563000ull, + 564000ull, 565000ull, 566000ull, 567000ull, + 568000ull, 569000ull, 586000ull, 587000ull, + 964000ull, 965000ull, 988000ull, 989000ull, + 570000ull, 571000ull, 572000ull, 573000ull, + 574000ull, 575000ull, 576000ull, 577000ull, + 578000ull, 579000ull, 596000ull, 597000ull, + 974000ull, 975000ull, 998000ull, 999000ull, + 600000ull, 601000ull, 602000ull, 603000ull, + 604000ull, 605000ull, 606000ull, 607000ull, + 608000ull, 609000ull, 680000ull, 681000ull, + 806000ull, 807000ull, 886000ull, 887000ull, + 610000ull, 611000ull, 612000ull, 613000ull, + 614000ull, 615000ull, 616000ull, 617000ull, + 618000ull, 619000ull, 690000ull, 691000ull, + 816000ull, 817000ull, 896000ull, 897000ull, + 620000ull, 621000ull, 622000ull, 623000ull, + 624000ull, 625000ull, 626000ull, 627000ull, + 628000ull, 629000ull, 682000ull, 683000ull, + 826000ull, 827000ull, 868000ull, 869000ull, + 630000ull, 631000ull, 632000ull, 633000ull, + 634000ull, 635000ull, 636000ull, 637000ull, + 638000ull, 639000ull, 692000ull, 693000ull, + 836000ull, 837000ull, 878000ull, 879000ull, + 640000ull, 641000ull, 642000ull, 643000ull, + 644000ull, 645000ull, 646000ull, 647000ull, + 648000ull, 649000ull, 684000ull, 685000ull, + 846000ull, 847000ull, 688000ull, 689000ull, + 650000ull, 651000ull, 652000ull, 653000ull, + 654000ull, 655000ull, 656000ull, 657000ull, + 658000ull, 659000ull, 694000ull, 695000ull, + 856000ull, 857000ull, 698000ull, 699000ull, + 660000ull, 661000ull, 662000ull, 663000ull, + 664000ull, 665000ull, 666000ull, 667000ull, + 668000ull, 669000ull, 686000ull, 687000ull, + 866000ull, 867000ull, 888000ull, 889000ull, + 670000ull, 671000ull, 672000ull, 673000ull, + 674000ull, 675000ull, 676000ull, 677000ull, + 678000ull, 679000ull, 696000ull, 697000ull, + 876000ull, 877000ull, 898000ull, 899000ull, + 700000ull, 701000ull, 702000ull, 703000ull, + 704000ull, 705000ull, 706000ull, 707000ull, + 708000ull, 709000ull, 780000ull, 781000ull, + 906000ull, 907000ull, 986000ull, 987000ull, + 710000ull, 711000ull, 712000ull, 713000ull, + 714000ull, 715000ull, 716000ull, 717000ull, + 718000ull, 719000ull, 790000ull, 791000ull, + 916000ull, 917000ull, 996000ull, 997000ull, + 720000ull, 721000ull, 722000ull, 723000ull, + 724000ull, 725000ull, 726000ull, 727000ull, + 728000ull, 729000ull, 782000ull, 783000ull, + 926000ull, 927000ull, 968000ull, 969000ull, + 730000ull, 731000ull, 732000ull, 733000ull, + 734000ull, 735000ull, 736000ull, 737000ull, + 738000ull, 739000ull, 792000ull, 793000ull, + 936000ull, 937000ull, 978000ull, 979000ull, + 740000ull, 741000ull, 742000ull, 743000ull, + 744000ull, 745000ull, 746000ull, 747000ull, + 748000ull, 749000ull, 784000ull, 785000ull, + 946000ull, 947000ull, 788000ull, 789000ull, + 750000ull, 751000ull, 752000ull, 753000ull, + 754000ull, 755000ull, 756000ull, 757000ull, + 758000ull, 759000ull, 794000ull, 795000ull, + 956000ull, 957000ull, 798000ull, 799000ull, + 760000ull, 761000ull, 762000ull, 763000ull, + 764000ull, 765000ull, 766000ull, 767000ull, + 768000ull, 769000ull, 786000ull, 787000ull, + 966000ull, 967000ull, 988000ull, 989000ull, + 770000ull, 771000ull, 772000ull, 773000ull, + 774000ull, 775000ull, 776000ull, 777000ull, + 778000ull, 779000ull, 796000ull, 797000ull, + 976000ull, 977000ull, 998000ull, 999000ull +}; + +static const UINT64 d2b3[] = { + 0000000ull, + 1000000ull, + 2000000ull, + 3000000ull, + 4000000ull, + 5000000ull, + 6000000ull, + 7000000ull, + 8000000ull, + 9000000ull, + 80000000ull, + 81000000ull, + 800000000ull, + 801000000ull, + 880000000ull, + 881000000ull, + + 10000000ull, + 11000000ull, + 12000000ull, + 13000000ull, + 14000000ull, + 15000000ull, + 16000000ull, + 17000000ull, + 18000000ull, + 19000000ull, + 90000000ull, + 91000000ull, + 810000000ull, + 811000000ull, + 890000000ull, + 891000000ull, + + 20000000ull, + 21000000ull, + 22000000ull, + 23000000ull, + 24000000ull, + 25000000ull, + 26000000ull, + 27000000ull, + 28000000ull, + 29000000ull, + 82000000ull, + 83000000ull, + 820000000ull, + 821000000ull, + 808000000ull, + 809000000ull, + + 30000000ull, + 31000000ull, + 32000000ull, + 33000000ull, + 34000000ull, + 35000000ull, + 36000000ull, + 37000000ull, + 38000000ull, + 39000000ull, + 92000000ull, + 93000000ull, + 830000000ull, + 831000000ull, + 818000000ull, + 819000000ull, + + 40000000ull, + 41000000ull, + 42000000ull, + 43000000ull, + 44000000ull, + 45000000ull, + 46000000ull, + 47000000ull, + 48000000ull, + 49000000ull, + 84000000ull, + 85000000ull, + 840000000ull, + 841000000ull, + 88000000ull, + 89000000ull, + + 50000000ull, + 51000000ull, + 52000000ull, + 53000000ull, + 54000000ull, + 55000000ull, + 56000000ull, + 57000000ull, + 58000000ull, + 59000000ull, + 94000000ull, + 95000000ull, + 850000000ull, + 851000000ull, + 98000000ull, + 99000000ull, + + 60000000ull, + 61000000ull, + 62000000ull, + 63000000ull, + 64000000ull, + 65000000ull, + 66000000ull, + 67000000ull, + 68000000ull, + 69000000ull, + 86000000ull, + 87000000ull, + 860000000ull, + 861000000ull, + 888000000ull, + 889000000ull, + + 70000000ull, + 71000000ull, + 72000000ull, + 73000000ull, + 74000000ull, + 75000000ull, + 76000000ull, + 77000000ull, + 78000000ull, + 79000000ull, + 96000000ull, + 97000000ull, + 870000000ull, + 871000000ull, + 898000000ull, + 899000000ull, + + 100000000ull, + 101000000ull, + 102000000ull, + 103000000ull, + 104000000ull, + 105000000ull, + 106000000ull, + 107000000ull, + 108000000ull, + 109000000ull, + 180000000ull, + 181000000ull, + 900000000ull, + 901000000ull, + 980000000ull, + 981000000ull, + + 110000000ull, + 111000000ull, + 112000000ull, + 113000000ull, + 114000000ull, + 115000000ull, + 116000000ull, + 117000000ull, + 118000000ull, + 119000000ull, + 190000000ull, + 191000000ull, + 910000000ull, + 911000000ull, + 990000000ull, + 991000000ull, + + 120000000ull, + 121000000ull, + 122000000ull, + 123000000ull, + 124000000ull, + 125000000ull, + 126000000ull, + 127000000ull, + 128000000ull, + 129000000ull, + 182000000ull, + 183000000ull, + 920000000ull, + 921000000ull, + 908000000ull, + 909000000ull, + + 130000000ull, + 131000000ull, + 132000000ull, + 133000000ull, + 134000000ull, + 135000000ull, + 136000000ull, + 137000000ull, + 138000000ull, + 139000000ull, + 192000000ull, + 193000000ull, + 930000000ull, + 931000000ull, + 918000000ull, + 919000000ull, + + 140000000ull, + 141000000ull, + 142000000ull, + 143000000ull, + 144000000ull, + 145000000ull, + 146000000ull, + 147000000ull, + 148000000ull, + 149000000ull, + 184000000ull, + 185000000ull, + 940000000ull, + 941000000ull, + 188000000ull, + 189000000ull, + + 150000000ull, + 151000000ull, + 152000000ull, + 153000000ull, + 154000000ull, + 155000000ull, + 156000000ull, + 157000000ull, + 158000000ull, + 159000000ull, + 194000000ull, + 195000000ull, + 950000000ull, + 951000000ull, + 198000000ull, + 199000000ull, + + 160000000ull, + 161000000ull, + 162000000ull, + 163000000ull, + 164000000ull, + 165000000ull, + 166000000ull, + 167000000ull, + 168000000ull, + 169000000ull, + 186000000ull, + 187000000ull, + 960000000ull, + 961000000ull, + 988000000ull, + 989000000ull, + + 170000000ull, + 171000000ull, + 172000000ull, + 173000000ull, + 174000000ull, + 175000000ull, + 176000000ull, + 177000000ull, + 178000000ull, + 179000000ull, + 196000000ull, + 197000000ull, + 970000000ull, + 971000000ull, + 998000000ull, + 999000000ull, + + 200000000ull, + 201000000ull, + 202000000ull, + 203000000ull, + 204000000ull, + 205000000ull, + 206000000ull, + 207000000ull, + 208000000ull, + 209000000ull, + 280000000ull, + 281000000ull, + 802000000ull, + 803000000ull, + 882000000ull, + 883000000ull, + + 210000000ull, + 211000000ull, + 212000000ull, + 213000000ull, + 214000000ull, + 215000000ull, + 216000000ull, + 217000000ull, + 218000000ull, + 219000000ull, + 290000000ull, + 291000000ull, + 812000000ull, + 813000000ull, + 892000000ull, + 893000000ull, + + 220000000ull, + 221000000ull, + 222000000ull, + 223000000ull, + 224000000ull, + 225000000ull, + 226000000ull, + 227000000ull, + 228000000ull, + 229000000ull, + 282000000ull, + 283000000ull, + 822000000ull, + 823000000ull, + 828000000ull, + 829000000ull, + + 230000000ull, + 231000000ull, + 232000000ull, + 233000000ull, + 234000000ull, + 235000000ull, + 236000000ull, + 237000000ull, + 238000000ull, + 239000000ull, + 292000000ull, + 293000000ull, + 832000000ull, + 833000000ull, + 838000000ull, + 839000000ull, + + 240000000ull, + 241000000ull, + 242000000ull, + 243000000ull, + 244000000ull, + 245000000ull, + 246000000ull, + 247000000ull, + 248000000ull, + 249000000ull, + 284000000ull, + 285000000ull, + 842000000ull, + 843000000ull, + 288000000ull, + 289000000ull, + + 250000000ull, + 251000000ull, + 252000000ull, + 253000000ull, + 254000000ull, + 255000000ull, + 256000000ull, + 257000000ull, + 258000000ull, + 259000000ull, + 294000000ull, + 295000000ull, + 852000000ull, + 853000000ull, + 298000000ull, + 299000000ull, + + 260000000ull, + 261000000ull, + 262000000ull, + 263000000ull, + 264000000ull, + 265000000ull, + 266000000ull, + 267000000ull, + 268000000ull, + 269000000ull, + 286000000ull, + 287000000ull, + 862000000ull, + 863000000ull, + 888000000ull, + 889000000ull, + + 270000000ull, + 271000000ull, + 272000000ull, + 273000000ull, + 274000000ull, + 275000000ull, + 276000000ull, + 277000000ull, + 278000000ull, + 279000000ull, + 296000000ull, + 297000000ull, + 872000000ull, + 873000000ull, + 898000000ull, + 899000000ull, + + 300000000ull, + 301000000ull, + 302000000ull, + 303000000ull, + 304000000ull, + 305000000ull, + 306000000ull, + 307000000ull, + 308000000ull, + 309000000ull, + 380000000ull, + 381000000ull, + 902000000ull, + 903000000ull, + 982000000ull, + 983000000ull, + + 310000000ull, + 311000000ull, + 312000000ull, + 313000000ull, + 314000000ull, + 315000000ull, + 316000000ull, + 317000000ull, + 318000000ull, + 319000000ull, + 390000000ull, + 391000000ull, + 912000000ull, + 913000000ull, + 992000000ull, + 993000000ull, + + 320000000ull, + 321000000ull, + 322000000ull, + 323000000ull, + 324000000ull, + 325000000ull, + 326000000ull, + 327000000ull, + 328000000ull, + 329000000ull, + 382000000ull, + 383000000ull, + 922000000ull, + 923000000ull, + 928000000ull, + 929000000ull, + + 330000000ull, + 331000000ull, + 332000000ull, + 333000000ull, + 334000000ull, + 335000000ull, + 336000000ull, + 337000000ull, + 338000000ull, + 339000000ull, + 392000000ull, + 393000000ull, + 932000000ull, + 933000000ull, + 938000000ull, + 939000000ull, + + 340000000ull, + 341000000ull, + 342000000ull, + 343000000ull, + 344000000ull, + 345000000ull, + 346000000ull, + 347000000ull, + 348000000ull, + 349000000ull, + 384000000ull, + 385000000ull, + 942000000ull, + 943000000ull, + 388000000ull, + 389000000ull, + + 350000000ull, + 351000000ull, + 352000000ull, + 353000000ull, + 354000000ull, + 355000000ull, + 356000000ull, + 357000000ull, + 358000000ull, + 359000000ull, + 394000000ull, + 395000000ull, + 952000000ull, + 953000000ull, + 398000000ull, + 399000000ull, + + 360000000ull, + 361000000ull, + 362000000ull, + 363000000ull, + 364000000ull, + 365000000ull, + 366000000ull, + 367000000ull, + 368000000ull, + 369000000ull, + 386000000ull, + 387000000ull, + 962000000ull, + 963000000ull, + 988000000ull, + 989000000ull, + + 370000000ull, + 371000000ull, + 372000000ull, + 373000000ull, + 374000000ull, + 375000000ull, + 376000000ull, + 377000000ull, + 378000000ull, + 379000000ull, + 396000000ull, + 397000000ull, + 972000000ull, + 973000000ull, + 998000000ull, + 999000000ull, + + 400000000ull, + 401000000ull, + 402000000ull, + 403000000ull, + 404000000ull, + 405000000ull, + 406000000ull, + 407000000ull, + 408000000ull, + 409000000ull, + 480000000ull, + 481000000ull, + 804000000ull, + 805000000ull, + 884000000ull, + 885000000ull, + + 410000000ull, + 411000000ull, + 412000000ull, + 413000000ull, + 414000000ull, + 415000000ull, + 416000000ull, + 417000000ull, + 418000000ull, + 419000000ull, + 490000000ull, + 491000000ull, + 814000000ull, + 815000000ull, + 894000000ull, + 895000000ull, + + 420000000ull, + 421000000ull, + 422000000ull, + 423000000ull, + 424000000ull, + 425000000ull, + 426000000ull, + 427000000ull, + 428000000ull, + 429000000ull, + 482000000ull, + 483000000ull, + 824000000ull, + 825000000ull, + 848000000ull, + 849000000ull, + + 430000000ull, + 431000000ull, + 432000000ull, + 433000000ull, + 434000000ull, + 435000000ull, + 436000000ull, + 437000000ull, + 438000000ull, + 439000000ull, + 492000000ull, + 493000000ull, + 834000000ull, + 835000000ull, + 858000000ull, + 859000000ull, + + 440000000ull, + 441000000ull, + 442000000ull, + 443000000ull, + 444000000ull, + 445000000ull, + 446000000ull, + 447000000ull, + 448000000ull, + 449000000ull, + 484000000ull, + 485000000ull, + 844000000ull, + 845000000ull, + 488000000ull, + 489000000ull, + + 450000000ull, + 451000000ull, + 452000000ull, + 453000000ull, + 454000000ull, + 455000000ull, + 456000000ull, + 457000000ull, + 458000000ull, + 459000000ull, + 494000000ull, + 495000000ull, + 854000000ull, + 855000000ull, + 498000000ull, + 499000000ull, + + 460000000ull, + 461000000ull, + 462000000ull, + 463000000ull, + 464000000ull, + 465000000ull, + 466000000ull, + 467000000ull, + 468000000ull, + 469000000ull, + 486000000ull, + 487000000ull, + 864000000ull, + 865000000ull, + 888000000ull, + 889000000ull, + + 470000000ull, + 471000000ull, + 472000000ull, + 473000000ull, + 474000000ull, + 475000000ull, + 476000000ull, + 477000000ull, + 478000000ull, + 479000000ull, + 496000000ull, + 497000000ull, + 874000000ull, + 875000000ull, + 898000000ull, + 899000000ull, + + 500000000ull, + 501000000ull, + 502000000ull, + 503000000ull, + 504000000ull, + 505000000ull, + 506000000ull, + 507000000ull, + 508000000ull, + 509000000ull, + 580000000ull, + 581000000ull, + 904000000ull, + 905000000ull, + 984000000ull, + 985000000ull, + + 510000000ull, + 511000000ull, + 512000000ull, + 513000000ull, + 514000000ull, + 515000000ull, + 516000000ull, + 517000000ull, + 518000000ull, + 519000000ull, + 590000000ull, + 591000000ull, + 914000000ull, + 915000000ull, + 994000000ull, + 995000000ull, + + 520000000ull, + 521000000ull, + 522000000ull, + 523000000ull, + 524000000ull, + 525000000ull, + 526000000ull, + 527000000ull, + 528000000ull, + 529000000ull, + 582000000ull, + 583000000ull, + 924000000ull, + 925000000ull, + 948000000ull, + 949000000ull, + + 530000000ull, + 531000000ull, + 532000000ull, + 533000000ull, + 534000000ull, + 535000000ull, + 536000000ull, + 537000000ull, + 538000000ull, + 539000000ull, + 592000000ull, + 593000000ull, + 934000000ull, + 935000000ull, + 958000000ull, + 959000000ull, + + 540000000ull, + 541000000ull, + 542000000ull, + 543000000ull, + 544000000ull, + 545000000ull, + 546000000ull, + 547000000ull, + 548000000ull, + 549000000ull, + 584000000ull, + 585000000ull, + 944000000ull, + 945000000ull, + 588000000ull, + 589000000ull, + + 550000000ull, + 551000000ull, + 552000000ull, + 553000000ull, + 554000000ull, + 555000000ull, + 556000000ull, + 557000000ull, + 558000000ull, + 559000000ull, + 594000000ull, + 595000000ull, + 954000000ull, + 955000000ull, + 598000000ull, + 599000000ull, + + 560000000ull, + 561000000ull, + 562000000ull, + 563000000ull, + 564000000ull, + 565000000ull, + 566000000ull, + 567000000ull, + 568000000ull, + 569000000ull, + 586000000ull, + 587000000ull, + 964000000ull, + 965000000ull, + 988000000ull, + 989000000ull, + + 570000000ull, + 571000000ull, + 572000000ull, + 573000000ull, + 574000000ull, + 575000000ull, + 576000000ull, + 577000000ull, + 578000000ull, + 579000000ull, + 596000000ull, + 597000000ull, + 974000000ull, + 975000000ull, + 998000000ull, + 999000000ull, + + 600000000ull, + 601000000ull, + 602000000ull, + 603000000ull, + 604000000ull, + 605000000ull, + 606000000ull, + 607000000ull, + 608000000ull, + 609000000ull, + 680000000ull, + 681000000ull, + 806000000ull, + 807000000ull, + 886000000ull, + 887000000ull, + + 610000000ull, + 611000000ull, + 612000000ull, + 613000000ull, + 614000000ull, + 615000000ull, + 616000000ull, + 617000000ull, + 618000000ull, + 619000000ull, + 690000000ull, + 691000000ull, + 816000000ull, + 817000000ull, + 896000000ull, + 897000000ull, + + 620000000ull, + 621000000ull, + 622000000ull, + 623000000ull, + 624000000ull, + 625000000ull, + 626000000ull, + 627000000ull, + 628000000ull, + 629000000ull, + 682000000ull, + 683000000ull, + 826000000ull, + 827000000ull, + 868000000ull, + 869000000ull, + + 630000000ull, + 631000000ull, + 632000000ull, + 633000000ull, + 634000000ull, + 635000000ull, + 636000000ull, + 637000000ull, + 638000000ull, + 639000000ull, + 692000000ull, + 693000000ull, + 836000000ull, + 837000000ull, + 878000000ull, + 879000000ull, + + 640000000ull, + 641000000ull, + 642000000ull, + 643000000ull, + 644000000ull, + 645000000ull, + 646000000ull, + 647000000ull, + 648000000ull, + 649000000ull, + 684000000ull, + 685000000ull, + 846000000ull, + 847000000ull, + 688000000ull, + 689000000ull, + + 650000000ull, + 651000000ull, + 652000000ull, + 653000000ull, + 654000000ull, + 655000000ull, + 656000000ull, + 657000000ull, + 658000000ull, + 659000000ull, + 694000000ull, + 695000000ull, + 856000000ull, + 857000000ull, + 698000000ull, + 699000000ull, + + 660000000ull, + 661000000ull, + 662000000ull, + 663000000ull, + 664000000ull, + 665000000ull, + 666000000ull, + 667000000ull, + 668000000ull, + 669000000ull, + 686000000ull, + 687000000ull, + 866000000ull, + 867000000ull, + 888000000ull, + 889000000ull, + + 670000000ull, + 671000000ull, + 672000000ull, + 673000000ull, + 674000000ull, + 675000000ull, + 676000000ull, + 677000000ull, + 678000000ull, + 679000000ull, + 696000000ull, + 697000000ull, + 876000000ull, + 877000000ull, + 898000000ull, + 899000000ull, + + 700000000ull, + 701000000ull, + 702000000ull, + 703000000ull, + 704000000ull, + 705000000ull, + 706000000ull, + 707000000ull, + 708000000ull, + 709000000ull, + 780000000ull, + 781000000ull, + 906000000ull, + 907000000ull, + 986000000ull, + 987000000ull, + + 710000000ull, + 711000000ull, + 712000000ull, + 713000000ull, + 714000000ull, + 715000000ull, + 716000000ull, + 717000000ull, + 718000000ull, + 719000000ull, + 790000000ull, + 791000000ull, + 916000000ull, + 917000000ull, + 996000000ull, + 997000000ull, + + 720000000ull, + 721000000ull, + 722000000ull, + 723000000ull, + 724000000ull, + 725000000ull, + 726000000ull, + 727000000ull, + 728000000ull, + 729000000ull, + 782000000ull, + 783000000ull, + 926000000ull, + 927000000ull, + 968000000ull, + 969000000ull, + + 730000000ull, + 731000000ull, + 732000000ull, + 733000000ull, + 734000000ull, + 735000000ull, + 736000000ull, + 737000000ull, + 738000000ull, + 739000000ull, + 792000000ull, + 793000000ull, + 936000000ull, + 937000000ull, + 978000000ull, + 979000000ull, + + 740000000ull, + 741000000ull, + 742000000ull, + 743000000ull, + 744000000ull, + 745000000ull, + 746000000ull, + 747000000ull, + 748000000ull, + 749000000ull, + 784000000ull, + 785000000ull, + 946000000ull, + 947000000ull, + 788000000ull, + 789000000ull, + + 750000000ull, + 751000000ull, + 752000000ull, + 753000000ull, + 754000000ull, + 755000000ull, + 756000000ull, + 757000000ull, + 758000000ull, + 759000000ull, + 794000000ull, + 795000000ull, + 956000000ull, + 957000000ull, + 798000000ull, + 799000000ull, + + 760000000ull, + 761000000ull, + 762000000ull, + 763000000ull, + 764000000ull, + 765000000ull, + 766000000ull, + 767000000ull, + 768000000ull, + 769000000ull, + 786000000ull, + 787000000ull, + 966000000ull, + 967000000ull, + 988000000ull, + 989000000ull, + + 770000000ull, + 771000000ull, + 772000000ull, + 773000000ull, + 774000000ull, + 775000000ull, + 776000000ull, + 777000000ull, + 778000000ull, + 779000000ull, + 796000000ull, + 797000000ull, + 976000000ull, + 977000000ull, + 998000000ull, + 999000000ull }; + +static const UINT64 d2b4[] = { + 0000000000ull, + 1000000000ull, + 2000000000ull, + 3000000000ull, + 4000000000ull, + 5000000000ull, + 6000000000ull, + 7000000000ull, + 8000000000ull, + 9000000000ull, + 80000000000ull, + 81000000000ull, + 800000000000ull, + 801000000000ull, + 880000000000ull, + 881000000000ull, + + 10000000000ull, + 11000000000ull, + 12000000000ull, + 13000000000ull, + 14000000000ull, + 15000000000ull, + 16000000000ull, + 17000000000ull, + 18000000000ull, + 19000000000ull, + 90000000000ull, + 91000000000ull, + 810000000000ull, + 811000000000ull, + 890000000000ull, + 891000000000ull, + + 20000000000ull, + 21000000000ull, + 22000000000ull, + 23000000000ull, + 24000000000ull, + 25000000000ull, + 26000000000ull, + 27000000000ull, + 28000000000ull, + 29000000000ull, + 82000000000ull, + 83000000000ull, + 820000000000ull, + 821000000000ull, + 808000000000ull, + 809000000000ull, + + 30000000000ull, + 31000000000ull, + 32000000000ull, + 33000000000ull, + 34000000000ull, + 35000000000ull, + 36000000000ull, + 37000000000ull, + 38000000000ull, + 39000000000ull, + 92000000000ull, + 93000000000ull, + 830000000000ull, + 831000000000ull, + 818000000000ull, + 819000000000ull, + + 40000000000ull, + 41000000000ull, + 42000000000ull, + 43000000000ull, + 44000000000ull, + 45000000000ull, + 46000000000ull, + 47000000000ull, + 48000000000ull, + 49000000000ull, + 84000000000ull, + 85000000000ull, + 840000000000ull, + 841000000000ull, + 88000000000ull, + 89000000000ull, + + 50000000000ull, + 51000000000ull, + 52000000000ull, + 53000000000ull, + 54000000000ull, + 55000000000ull, + 56000000000ull, + 57000000000ull, + 58000000000ull, + 59000000000ull, + 94000000000ull, + 95000000000ull, + 850000000000ull, + 851000000000ull, + 98000000000ull, + 99000000000ull, + + 60000000000ull, + 61000000000ull, + 62000000000ull, + 63000000000ull, + 64000000000ull, + 65000000000ull, + 66000000000ull, + 67000000000ull, + 68000000000ull, + 69000000000ull, + 86000000000ull, + 87000000000ull, + 860000000000ull, + 861000000000ull, + 888000000000ull, + 889000000000ull, + + 70000000000ull, + 71000000000ull, + 72000000000ull, + 73000000000ull, + 74000000000ull, + 75000000000ull, + 76000000000ull, + 77000000000ull, + 78000000000ull, + 79000000000ull, + 96000000000ull, + 97000000000ull, + 870000000000ull, + 871000000000ull, + 898000000000ull, + 899000000000ull, + + 100000000000ull, + 101000000000ull, + 102000000000ull, + 103000000000ull, + 104000000000ull, + 105000000000ull, + 106000000000ull, + 107000000000ull, + 108000000000ull, + 109000000000ull, + 180000000000ull, + 181000000000ull, + 900000000000ull, + 901000000000ull, + 980000000000ull, + 981000000000ull, + + 110000000000ull, + 111000000000ull, + 112000000000ull, + 113000000000ull, + 114000000000ull, + 115000000000ull, + 116000000000ull, + 117000000000ull, + 118000000000ull, + 119000000000ull, + 190000000000ull, + 191000000000ull, + 910000000000ull, + 911000000000ull, + 990000000000ull, + 991000000000ull, + + 120000000000ull, + 121000000000ull, + 122000000000ull, + 123000000000ull, + 124000000000ull, + 125000000000ull, + 126000000000ull, + 127000000000ull, + 128000000000ull, + 129000000000ull, + 182000000000ull, + 183000000000ull, + 920000000000ull, + 921000000000ull, + 908000000000ull, + 909000000000ull, + + 130000000000ull, + 131000000000ull, + 132000000000ull, + 133000000000ull, + 134000000000ull, + 135000000000ull, + 136000000000ull, + 137000000000ull, + 138000000000ull, + 139000000000ull, + 192000000000ull, + 193000000000ull, + 930000000000ull, + 931000000000ull, + 918000000000ull, + 919000000000ull, + + 140000000000ull, + 141000000000ull, + 142000000000ull, + 143000000000ull, + 144000000000ull, + 145000000000ull, + 146000000000ull, + 147000000000ull, + 148000000000ull, + 149000000000ull, + 184000000000ull, + 185000000000ull, + 940000000000ull, + 941000000000ull, + 188000000000ull, + 189000000000ull, + + 150000000000ull, + 151000000000ull, + 152000000000ull, + 153000000000ull, + 154000000000ull, + 155000000000ull, + 156000000000ull, + 157000000000ull, + 158000000000ull, + 159000000000ull, + 194000000000ull, + 195000000000ull, + 950000000000ull, + 951000000000ull, + 198000000000ull, + 199000000000ull, + + 160000000000ull, + 161000000000ull, + 162000000000ull, + 163000000000ull, + 164000000000ull, + 165000000000ull, + 166000000000ull, + 167000000000ull, + 168000000000ull, + 169000000000ull, + 186000000000ull, + 187000000000ull, + 960000000000ull, + 961000000000ull, + 988000000000ull, + 989000000000ull, + + 170000000000ull, + 171000000000ull, + 172000000000ull, + 173000000000ull, + 174000000000ull, + 175000000000ull, + 176000000000ull, + 177000000000ull, + 178000000000ull, + 179000000000ull, + 196000000000ull, + 197000000000ull, + 970000000000ull, + 971000000000ull, + 998000000000ull, + 999000000000ull, + + 200000000000ull, + 201000000000ull, + 202000000000ull, + 203000000000ull, + 204000000000ull, + 205000000000ull, + 206000000000ull, + 207000000000ull, + 208000000000ull, + 209000000000ull, + 280000000000ull, + 281000000000ull, + 802000000000ull, + 803000000000ull, + 882000000000ull, + 883000000000ull, + + 210000000000ull, + 211000000000ull, + 212000000000ull, + 213000000000ull, + 214000000000ull, + 215000000000ull, + 216000000000ull, + 217000000000ull, + 218000000000ull, + 219000000000ull, + 290000000000ull, + 291000000000ull, + 812000000000ull, + 813000000000ull, + 892000000000ull, + 893000000000ull, + + 220000000000ull, + 221000000000ull, + 222000000000ull, + 223000000000ull, + 224000000000ull, + 225000000000ull, + 226000000000ull, + 227000000000ull, + 228000000000ull, + 229000000000ull, + 282000000000ull, + 283000000000ull, + 822000000000ull, + 823000000000ull, + 828000000000ull, + 829000000000ull, + + 230000000000ull, + 231000000000ull, + 232000000000ull, + 233000000000ull, + 234000000000ull, + 235000000000ull, + 236000000000ull, + 237000000000ull, + 238000000000ull, + 239000000000ull, + 292000000000ull, + 293000000000ull, + 832000000000ull, + 833000000000ull, + 838000000000ull, + 839000000000ull, + + 240000000000ull, + 241000000000ull, + 242000000000ull, + 243000000000ull, + 244000000000ull, + 245000000000ull, + 246000000000ull, + 247000000000ull, + 248000000000ull, + 249000000000ull, + 284000000000ull, + 285000000000ull, + 842000000000ull, + 843000000000ull, + 288000000000ull, + 289000000000ull, + + 250000000000ull, + 251000000000ull, + 252000000000ull, + 253000000000ull, + 254000000000ull, + 255000000000ull, + 256000000000ull, + 257000000000ull, + 258000000000ull, + 259000000000ull, + 294000000000ull, + 295000000000ull, + 852000000000ull, + 853000000000ull, + 298000000000ull, + 299000000000ull, + + 260000000000ull, + 261000000000ull, + 262000000000ull, + 263000000000ull, + 264000000000ull, + 265000000000ull, + 266000000000ull, + 267000000000ull, + 268000000000ull, + 269000000000ull, + 286000000000ull, + 287000000000ull, + 862000000000ull, + 863000000000ull, + 888000000000ull, + 889000000000ull, + + 270000000000ull, + 271000000000ull, + 272000000000ull, + 273000000000ull, + 274000000000ull, + 275000000000ull, + 276000000000ull, + 277000000000ull, + 278000000000ull, + 279000000000ull, + 296000000000ull, + 297000000000ull, + 872000000000ull, + 873000000000ull, + 898000000000ull, + 899000000000ull, + + 300000000000ull, + 301000000000ull, + 302000000000ull, + 303000000000ull, + 304000000000ull, + 305000000000ull, + 306000000000ull, + 307000000000ull, + 308000000000ull, + 309000000000ull, + 380000000000ull, + 381000000000ull, + 902000000000ull, + 903000000000ull, + 982000000000ull, + 983000000000ull, + + 310000000000ull, + 311000000000ull, + 312000000000ull, + 313000000000ull, + 314000000000ull, + 315000000000ull, + 316000000000ull, + 317000000000ull, + 318000000000ull, + 319000000000ull, + 390000000000ull, + 391000000000ull, + 912000000000ull, + 913000000000ull, + 992000000000ull, + 993000000000ull, + + 320000000000ull, + 321000000000ull, + 322000000000ull, + 323000000000ull, + 324000000000ull, + 325000000000ull, + 326000000000ull, + 327000000000ull, + 328000000000ull, + 329000000000ull, + 382000000000ull, + 383000000000ull, + 922000000000ull, + 923000000000ull, + 928000000000ull, + 929000000000ull, + + 330000000000ull, + 331000000000ull, + 332000000000ull, + 333000000000ull, + 334000000000ull, + 335000000000ull, + 336000000000ull, + 337000000000ull, + 338000000000ull, + 339000000000ull, + 392000000000ull, + 393000000000ull, + 932000000000ull, + 933000000000ull, + 938000000000ull, + 939000000000ull, + + 340000000000ull, + 341000000000ull, + 342000000000ull, + 343000000000ull, + 344000000000ull, + 345000000000ull, + 346000000000ull, + 347000000000ull, + 348000000000ull, + 349000000000ull, + 384000000000ull, + 385000000000ull, + 942000000000ull, + 943000000000ull, + 388000000000ull, + 389000000000ull, + + 350000000000ull, + 351000000000ull, + 352000000000ull, + 353000000000ull, + 354000000000ull, + 355000000000ull, + 356000000000ull, + 357000000000ull, + 358000000000ull, + 359000000000ull, + 394000000000ull, + 395000000000ull, + 952000000000ull, + 953000000000ull, + 398000000000ull, + 399000000000ull, + + 360000000000ull, + 361000000000ull, + 362000000000ull, + 363000000000ull, + 364000000000ull, + 365000000000ull, + 366000000000ull, + 367000000000ull, + 368000000000ull, + 369000000000ull, + 386000000000ull, + 387000000000ull, + 962000000000ull, + 963000000000ull, + 988000000000ull, + 989000000000ull, + + 370000000000ull, + 371000000000ull, + 372000000000ull, + 373000000000ull, + 374000000000ull, + 375000000000ull, + 376000000000ull, + 377000000000ull, + 378000000000ull, + 379000000000ull, + 396000000000ull, + 397000000000ull, + 972000000000ull, + 973000000000ull, + 998000000000ull, + 999000000000ull, + + 400000000000ull, + 401000000000ull, + 402000000000ull, + 403000000000ull, + 404000000000ull, + 405000000000ull, + 406000000000ull, + 407000000000ull, + 408000000000ull, + 409000000000ull, + 480000000000ull, + 481000000000ull, + 804000000000ull, + 805000000000ull, + 884000000000ull, + 885000000000ull, + + 410000000000ull, + 411000000000ull, + 412000000000ull, + 413000000000ull, + 414000000000ull, + 415000000000ull, + 416000000000ull, + 417000000000ull, + 418000000000ull, + 419000000000ull, + 490000000000ull, + 491000000000ull, + 814000000000ull, + 815000000000ull, + 894000000000ull, + 895000000000ull, + + 420000000000ull, + 421000000000ull, + 422000000000ull, + 423000000000ull, + 424000000000ull, + 425000000000ull, + 426000000000ull, + 427000000000ull, + 428000000000ull, + 429000000000ull, + 482000000000ull, + 483000000000ull, + 824000000000ull, + 825000000000ull, + 848000000000ull, + 849000000000ull, + + 430000000000ull, + 431000000000ull, + 432000000000ull, + 433000000000ull, + 434000000000ull, + 435000000000ull, + 436000000000ull, + 437000000000ull, + 438000000000ull, + 439000000000ull, + 492000000000ull, + 493000000000ull, + 834000000000ull, + 835000000000ull, + 858000000000ull, + 859000000000ull, + + 440000000000ull, + 441000000000ull, + 442000000000ull, + 443000000000ull, + 444000000000ull, + 445000000000ull, + 446000000000ull, + 447000000000ull, + 448000000000ull, + 449000000000ull, + 484000000000ull, + 485000000000ull, + 844000000000ull, + 845000000000ull, + 488000000000ull, + 489000000000ull, + + 450000000000ull, + 451000000000ull, + 452000000000ull, + 453000000000ull, + 454000000000ull, + 455000000000ull, + 456000000000ull, + 457000000000ull, + 458000000000ull, + 459000000000ull, + 494000000000ull, + 495000000000ull, + 854000000000ull, + 855000000000ull, + 498000000000ull, + 499000000000ull, + + 460000000000ull, + 461000000000ull, + 462000000000ull, + 463000000000ull, + 464000000000ull, + 465000000000ull, + 466000000000ull, + 467000000000ull, + 468000000000ull, + 469000000000ull, + 486000000000ull, + 487000000000ull, + 864000000000ull, + 865000000000ull, + 888000000000ull, + 889000000000ull, + + 470000000000ull, + 471000000000ull, + 472000000000ull, + 473000000000ull, + 474000000000ull, + 475000000000ull, + 476000000000ull, + 477000000000ull, + 478000000000ull, + 479000000000ull, + 496000000000ull, + 497000000000ull, + 874000000000ull, + 875000000000ull, + 898000000000ull, + 899000000000ull, + + 500000000000ull, + 501000000000ull, + 502000000000ull, + 503000000000ull, + 504000000000ull, + 505000000000ull, + 506000000000ull, + 507000000000ull, + 508000000000ull, + 509000000000ull, + 580000000000ull, + 581000000000ull, + 904000000000ull, + 905000000000ull, + 984000000000ull, + 985000000000ull, + + 510000000000ull, + 511000000000ull, + 512000000000ull, + 513000000000ull, + 514000000000ull, + 515000000000ull, + 516000000000ull, + 517000000000ull, + 518000000000ull, + 519000000000ull, + 590000000000ull, + 591000000000ull, + 914000000000ull, + 915000000000ull, + 994000000000ull, + 995000000000ull, + + 520000000000ull, + 521000000000ull, + 522000000000ull, + 523000000000ull, + 524000000000ull, + 525000000000ull, + 526000000000ull, + 527000000000ull, + 528000000000ull, + 529000000000ull, + 582000000000ull, + 583000000000ull, + 924000000000ull, + 925000000000ull, + 948000000000ull, + 949000000000ull, + + 530000000000ull, + 531000000000ull, + 532000000000ull, + 533000000000ull, + 534000000000ull, + 535000000000ull, + 536000000000ull, + 537000000000ull, + 538000000000ull, + 539000000000ull, + 592000000000ull, + 593000000000ull, + 934000000000ull, + 935000000000ull, + 958000000000ull, + 959000000000ull, + + 540000000000ull, + 541000000000ull, + 542000000000ull, + 543000000000ull, + 544000000000ull, + 545000000000ull, + 546000000000ull, + 547000000000ull, + 548000000000ull, + 549000000000ull, + 584000000000ull, + 585000000000ull, + 944000000000ull, + 945000000000ull, + 588000000000ull, + 589000000000ull, + + 550000000000ull, + 551000000000ull, + 552000000000ull, + 553000000000ull, + 554000000000ull, + 555000000000ull, + 556000000000ull, + 557000000000ull, + 558000000000ull, + 559000000000ull, + 594000000000ull, + 595000000000ull, + 954000000000ull, + 955000000000ull, + 598000000000ull, + 599000000000ull, + + 560000000000ull, + 561000000000ull, + 562000000000ull, + 563000000000ull, + 564000000000ull, + 565000000000ull, + 566000000000ull, + 567000000000ull, + 568000000000ull, + 569000000000ull, + 586000000000ull, + 587000000000ull, + 964000000000ull, + 965000000000ull, + 988000000000ull, + 989000000000ull, + + 570000000000ull, + 571000000000ull, + 572000000000ull, + 573000000000ull, + 574000000000ull, + 575000000000ull, + 576000000000ull, + 577000000000ull, + 578000000000ull, + 579000000000ull, + 596000000000ull, + 597000000000ull, + 974000000000ull, + 975000000000ull, + 998000000000ull, + 999000000000ull, + + 600000000000ull, + 601000000000ull, + 602000000000ull, + 603000000000ull, + 604000000000ull, + 605000000000ull, + 606000000000ull, + 607000000000ull, + 608000000000ull, + 609000000000ull, + 680000000000ull, + 681000000000ull, + 806000000000ull, + 807000000000ull, + 886000000000ull, + 887000000000ull, + + 610000000000ull, + 611000000000ull, + 612000000000ull, + 613000000000ull, + 614000000000ull, + 615000000000ull, + 616000000000ull, + 617000000000ull, + 618000000000ull, + 619000000000ull, + 690000000000ull, + 691000000000ull, + 816000000000ull, + 817000000000ull, + 896000000000ull, + 897000000000ull, + + 620000000000ull, + 621000000000ull, + 622000000000ull, + 623000000000ull, + 624000000000ull, + 625000000000ull, + 626000000000ull, + 627000000000ull, + 628000000000ull, + 629000000000ull, + 682000000000ull, + 683000000000ull, + 826000000000ull, + 827000000000ull, + 868000000000ull, + 869000000000ull, + + 630000000000ull, + 631000000000ull, + 632000000000ull, + 633000000000ull, + 634000000000ull, + 635000000000ull, + 636000000000ull, + 637000000000ull, + 638000000000ull, + 639000000000ull, + 692000000000ull, + 693000000000ull, + 836000000000ull, + 837000000000ull, + 878000000000ull, + 879000000000ull, + + 640000000000ull, + 641000000000ull, + 642000000000ull, + 643000000000ull, + 644000000000ull, + 645000000000ull, + 646000000000ull, + 647000000000ull, + 648000000000ull, + 649000000000ull, + 684000000000ull, + 685000000000ull, + 846000000000ull, + 847000000000ull, + 688000000000ull, + 689000000000ull, + + 650000000000ull, + 651000000000ull, + 652000000000ull, + 653000000000ull, + 654000000000ull, + 655000000000ull, + 656000000000ull, + 657000000000ull, + 658000000000ull, + 659000000000ull, + 694000000000ull, + 695000000000ull, + 856000000000ull, + 857000000000ull, + 698000000000ull, + 699000000000ull, + + 660000000000ull, + 661000000000ull, + 662000000000ull, + 663000000000ull, + 664000000000ull, + 665000000000ull, + 666000000000ull, + 667000000000ull, + 668000000000ull, + 669000000000ull, + 686000000000ull, + 687000000000ull, + 866000000000ull, + 867000000000ull, + 888000000000ull, + 889000000000ull, + + 670000000000ull, + 671000000000ull, + 672000000000ull, + 673000000000ull, + 674000000000ull, + 675000000000ull, + 676000000000ull, + 677000000000ull, + 678000000000ull, + 679000000000ull, + 696000000000ull, + 697000000000ull, + 876000000000ull, + 877000000000ull, + 898000000000ull, + 899000000000ull, + + 700000000000ull, + 701000000000ull, + 702000000000ull, + 703000000000ull, + 704000000000ull, + 705000000000ull, + 706000000000ull, + 707000000000ull, + 708000000000ull, + 709000000000ull, + 780000000000ull, + 781000000000ull, + 906000000000ull, + 907000000000ull, + 986000000000ull, + 987000000000ull, + + 710000000000ull, + 711000000000ull, + 712000000000ull, + 713000000000ull, + 714000000000ull, + 715000000000ull, + 716000000000ull, + 717000000000ull, + 718000000000ull, + 719000000000ull, + 790000000000ull, + 791000000000ull, + 916000000000ull, + 917000000000ull, + 996000000000ull, + 997000000000ull, + + 720000000000ull, + 721000000000ull, + 722000000000ull, + 723000000000ull, + 724000000000ull, + 725000000000ull, + 726000000000ull, + 727000000000ull, + 728000000000ull, + 729000000000ull, + 782000000000ull, + 783000000000ull, + 926000000000ull, + 927000000000ull, + 968000000000ull, + 969000000000ull, + + 730000000000ull, + 731000000000ull, + 732000000000ull, + 733000000000ull, + 734000000000ull, + 735000000000ull, + 736000000000ull, + 737000000000ull, + 738000000000ull, + 739000000000ull, + 792000000000ull, + 793000000000ull, + 936000000000ull, + 937000000000ull, + 978000000000ull, + 979000000000ull, + + 740000000000ull, + 741000000000ull, + 742000000000ull, + 743000000000ull, + 744000000000ull, + 745000000000ull, + 746000000000ull, + 747000000000ull, + 748000000000ull, + 749000000000ull, + 784000000000ull, + 785000000000ull, + 946000000000ull, + 947000000000ull, + 788000000000ull, + 789000000000ull, + + 750000000000ull, + 751000000000ull, + 752000000000ull, + 753000000000ull, + 754000000000ull, + 755000000000ull, + 756000000000ull, + 757000000000ull, + 758000000000ull, + 759000000000ull, + 794000000000ull, + 795000000000ull, + 956000000000ull, + 957000000000ull, + 798000000000ull, + 799000000000ull, + + 760000000000ull, + 761000000000ull, + 762000000000ull, + 763000000000ull, + 764000000000ull, + 765000000000ull, + 766000000000ull, + 767000000000ull, + 768000000000ull, + 769000000000ull, + 786000000000ull, + 787000000000ull, + 966000000000ull, + 967000000000ull, + 988000000000ull, + 989000000000ull, + + 770000000000ull, + 771000000000ull, + 772000000000ull, + 773000000000ull, + 774000000000ull, + 775000000000ull, + 776000000000ull, + 777000000000ull, + 778000000000ull, + 779000000000ull, + 796000000000ull, + 797000000000ull, + 976000000000ull, + 977000000000ull, + 998000000000ull, + 999000000000ull +}; + +static const UINT64 d2b5[] = { + 0000000000000ull, + 1000000000000ull, + 2000000000000ull, + 3000000000000ull, + 4000000000000ull, + 5000000000000ull, + 6000000000000ull, + 7000000000000ull, + 8000000000000ull, + 9000000000000ull, + 80000000000000ull, + 81000000000000ull, + 800000000000000ull, + 801000000000000ull, + 880000000000000ull, + 881000000000000ull, + + 10000000000000ull, + 11000000000000ull, + 12000000000000ull, + 13000000000000ull, + 14000000000000ull, + 15000000000000ull, + 16000000000000ull, + 17000000000000ull, + 18000000000000ull, + 19000000000000ull, + 90000000000000ull, + 91000000000000ull, + 810000000000000ull, + 811000000000000ull, + 890000000000000ull, + 891000000000000ull, + + 20000000000000ull, + 21000000000000ull, + 22000000000000ull, + 23000000000000ull, + 24000000000000ull, + 25000000000000ull, + 26000000000000ull, + 27000000000000ull, + 28000000000000ull, + 29000000000000ull, + 82000000000000ull, + 83000000000000ull, + 820000000000000ull, + 821000000000000ull, + 808000000000000ull, + 809000000000000ull, + + 30000000000000ull, + 31000000000000ull, + 32000000000000ull, + 33000000000000ull, + 34000000000000ull, + 35000000000000ull, + 36000000000000ull, + 37000000000000ull, + 38000000000000ull, + 39000000000000ull, + 92000000000000ull, + 93000000000000ull, + 830000000000000ull, + 831000000000000ull, + 818000000000000ull, + 819000000000000ull, + + 40000000000000ull, + 41000000000000ull, + 42000000000000ull, + 43000000000000ull, + 44000000000000ull, + 45000000000000ull, + 46000000000000ull, + 47000000000000ull, + 48000000000000ull, + 49000000000000ull, + 84000000000000ull, + 85000000000000ull, + 840000000000000ull, + 841000000000000ull, + 88000000000000ull, + 89000000000000ull, + + 50000000000000ull, + 51000000000000ull, + 52000000000000ull, + 53000000000000ull, + 54000000000000ull, + 55000000000000ull, + 56000000000000ull, + 57000000000000ull, + 58000000000000ull, + 59000000000000ull, + 94000000000000ull, + 95000000000000ull, + 850000000000000ull, + 851000000000000ull, + 98000000000000ull, + 99000000000000ull, + + 60000000000000ull, + 61000000000000ull, + 62000000000000ull, + 63000000000000ull, + 64000000000000ull, + 65000000000000ull, + 66000000000000ull, + 67000000000000ull, + 68000000000000ull, + 69000000000000ull, + 86000000000000ull, + 87000000000000ull, + 860000000000000ull, + 861000000000000ull, + 888000000000000ull, + 889000000000000ull, + + 70000000000000ull, + 71000000000000ull, + 72000000000000ull, + 73000000000000ull, + 74000000000000ull, + 75000000000000ull, + 76000000000000ull, + 77000000000000ull, + 78000000000000ull, + 79000000000000ull, + 96000000000000ull, + 97000000000000ull, + 870000000000000ull, + 871000000000000ull, + 898000000000000ull, + 899000000000000ull, + + 100000000000000ull, + 101000000000000ull, + 102000000000000ull, + 103000000000000ull, + 104000000000000ull, + 105000000000000ull, + 106000000000000ull, + 107000000000000ull, + 108000000000000ull, + 109000000000000ull, + 180000000000000ull, + 181000000000000ull, + 900000000000000ull, + 901000000000000ull, + 980000000000000ull, + 981000000000000ull, + + 110000000000000ull, + 111000000000000ull, + 112000000000000ull, + 113000000000000ull, + 114000000000000ull, + 115000000000000ull, + 116000000000000ull, + 117000000000000ull, + 118000000000000ull, + 119000000000000ull, + 190000000000000ull, + 191000000000000ull, + 910000000000000ull, + 911000000000000ull, + 990000000000000ull, + 991000000000000ull, + + 120000000000000ull, + 121000000000000ull, + 122000000000000ull, + 123000000000000ull, + 124000000000000ull, + 125000000000000ull, + 126000000000000ull, + 127000000000000ull, + 128000000000000ull, + 129000000000000ull, + 182000000000000ull, + 183000000000000ull, + 920000000000000ull, + 921000000000000ull, + 908000000000000ull, + 909000000000000ull, + + 130000000000000ull, + 131000000000000ull, + 132000000000000ull, + 133000000000000ull, + 134000000000000ull, + 135000000000000ull, + 136000000000000ull, + 137000000000000ull, + 138000000000000ull, + 139000000000000ull, + 192000000000000ull, + 193000000000000ull, + 930000000000000ull, + 931000000000000ull, + 918000000000000ull, + 919000000000000ull, + + 140000000000000ull, + 141000000000000ull, + 142000000000000ull, + 143000000000000ull, + 144000000000000ull, + 145000000000000ull, + 146000000000000ull, + 147000000000000ull, + 148000000000000ull, + 149000000000000ull, + 184000000000000ull, + 185000000000000ull, + 940000000000000ull, + 941000000000000ull, + 188000000000000ull, + 189000000000000ull, + + 150000000000000ull, + 151000000000000ull, + 152000000000000ull, + 153000000000000ull, + 154000000000000ull, + 155000000000000ull, + 156000000000000ull, + 157000000000000ull, + 158000000000000ull, + 159000000000000ull, + 194000000000000ull, + 195000000000000ull, + 950000000000000ull, + 951000000000000ull, + 198000000000000ull, + 199000000000000ull, + + 160000000000000ull, + 161000000000000ull, + 162000000000000ull, + 163000000000000ull, + 164000000000000ull, + 165000000000000ull, + 166000000000000ull, + 167000000000000ull, + 168000000000000ull, + 169000000000000ull, + 186000000000000ull, + 187000000000000ull, + 960000000000000ull, + 961000000000000ull, + 988000000000000ull, + 989000000000000ull, + + 170000000000000ull, + 171000000000000ull, + 172000000000000ull, + 173000000000000ull, + 174000000000000ull, + 175000000000000ull, + 176000000000000ull, + 177000000000000ull, + 178000000000000ull, + 179000000000000ull, + 196000000000000ull, + 197000000000000ull, + 970000000000000ull, + 971000000000000ull, + 998000000000000ull, + 999000000000000ull, + + 200000000000000ull, + 201000000000000ull, + 202000000000000ull, + 203000000000000ull, + 204000000000000ull, + 205000000000000ull, + 206000000000000ull, + 207000000000000ull, + 208000000000000ull, + 209000000000000ull, + 280000000000000ull, + 281000000000000ull, + 802000000000000ull, + 803000000000000ull, + 882000000000000ull, + 883000000000000ull, + + 210000000000000ull, + 211000000000000ull, + 212000000000000ull, + 213000000000000ull, + 214000000000000ull, + 215000000000000ull, + 216000000000000ull, + 217000000000000ull, + 218000000000000ull, + 219000000000000ull, + 290000000000000ull, + 291000000000000ull, + 812000000000000ull, + 813000000000000ull, + 892000000000000ull, + 893000000000000ull, + + 220000000000000ull, + 221000000000000ull, + 222000000000000ull, + 223000000000000ull, + 224000000000000ull, + 225000000000000ull, + 226000000000000ull, + 227000000000000ull, + 228000000000000ull, + 229000000000000ull, + 282000000000000ull, + 283000000000000ull, + 822000000000000ull, + 823000000000000ull, + 828000000000000ull, + 829000000000000ull, + + 230000000000000ull, + 231000000000000ull, + 232000000000000ull, + 233000000000000ull, + 234000000000000ull, + 235000000000000ull, + 236000000000000ull, + 237000000000000ull, + 238000000000000ull, + 239000000000000ull, + 292000000000000ull, + 293000000000000ull, + 832000000000000ull, + 833000000000000ull, + 838000000000000ull, + 839000000000000ull, + + 240000000000000ull, + 241000000000000ull, + 242000000000000ull, + 243000000000000ull, + 244000000000000ull, + 245000000000000ull, + 246000000000000ull, + 247000000000000ull, + 248000000000000ull, + 249000000000000ull, + 284000000000000ull, + 285000000000000ull, + 842000000000000ull, + 843000000000000ull, + 288000000000000ull, + 289000000000000ull, + + 250000000000000ull, + 251000000000000ull, + 252000000000000ull, + 253000000000000ull, + 254000000000000ull, + 255000000000000ull, + 256000000000000ull, + 257000000000000ull, + 258000000000000ull, + 259000000000000ull, + 294000000000000ull, + 295000000000000ull, + 852000000000000ull, + 853000000000000ull, + 298000000000000ull, + 299000000000000ull, + + 260000000000000ull, + 261000000000000ull, + 262000000000000ull, + 263000000000000ull, + 264000000000000ull, + 265000000000000ull, + 266000000000000ull, + 267000000000000ull, + 268000000000000ull, + 269000000000000ull, + 286000000000000ull, + 287000000000000ull, + 862000000000000ull, + 863000000000000ull, + 888000000000000ull, + 889000000000000ull, + + 270000000000000ull, + 271000000000000ull, + 272000000000000ull, + 273000000000000ull, + 274000000000000ull, + 275000000000000ull, + 276000000000000ull, + 277000000000000ull, + 278000000000000ull, + 279000000000000ull, + 296000000000000ull, + 297000000000000ull, + 872000000000000ull, + 873000000000000ull, + 898000000000000ull, + 899000000000000ull, + + 300000000000000ull, + 301000000000000ull, + 302000000000000ull, + 303000000000000ull, + 304000000000000ull, + 305000000000000ull, + 306000000000000ull, + 307000000000000ull, + 308000000000000ull, + 309000000000000ull, + 380000000000000ull, + 381000000000000ull, + 902000000000000ull, + 903000000000000ull, + 982000000000000ull, + 983000000000000ull, + + 310000000000000ull, + 311000000000000ull, + 312000000000000ull, + 313000000000000ull, + 314000000000000ull, + 315000000000000ull, + 316000000000000ull, + 317000000000000ull, + 318000000000000ull, + 319000000000000ull, + 390000000000000ull, + 391000000000000ull, + 912000000000000ull, + 913000000000000ull, + 992000000000000ull, + 993000000000000ull, + + 320000000000000ull, + 321000000000000ull, + 322000000000000ull, + 323000000000000ull, + 324000000000000ull, + 325000000000000ull, + 326000000000000ull, + 327000000000000ull, + 328000000000000ull, + 329000000000000ull, + 382000000000000ull, + 383000000000000ull, + 922000000000000ull, + 923000000000000ull, + 928000000000000ull, + 929000000000000ull, + + 330000000000000ull, + 331000000000000ull, + 332000000000000ull, + 333000000000000ull, + 334000000000000ull, + 335000000000000ull, + 336000000000000ull, + 337000000000000ull, + 338000000000000ull, + 339000000000000ull, + 392000000000000ull, + 393000000000000ull, + 932000000000000ull, + 933000000000000ull, + 938000000000000ull, + 939000000000000ull, + + 340000000000000ull, + 341000000000000ull, + 342000000000000ull, + 343000000000000ull, + 344000000000000ull, + 345000000000000ull, + 346000000000000ull, + 347000000000000ull, + 348000000000000ull, + 349000000000000ull, + 384000000000000ull, + 385000000000000ull, + 942000000000000ull, + 943000000000000ull, + 388000000000000ull, + 389000000000000ull, + + 350000000000000ull, + 351000000000000ull, + 352000000000000ull, + 353000000000000ull, + 354000000000000ull, + 355000000000000ull, + 356000000000000ull, + 357000000000000ull, + 358000000000000ull, + 359000000000000ull, + 394000000000000ull, + 395000000000000ull, + 952000000000000ull, + 953000000000000ull, + 398000000000000ull, + 399000000000000ull, + + 360000000000000ull, + 361000000000000ull, + 362000000000000ull, + 363000000000000ull, + 364000000000000ull, + 365000000000000ull, + 366000000000000ull, + 367000000000000ull, + 368000000000000ull, + 369000000000000ull, + 386000000000000ull, + 387000000000000ull, + 962000000000000ull, + 963000000000000ull, + 988000000000000ull, + 989000000000000ull, + + 370000000000000ull, + 371000000000000ull, + 372000000000000ull, + 373000000000000ull, + 374000000000000ull, + 375000000000000ull, + 376000000000000ull, + 377000000000000ull, + 378000000000000ull, + 379000000000000ull, + 396000000000000ull, + 397000000000000ull, + 972000000000000ull, + 973000000000000ull, + 998000000000000ull, + 999000000000000ull, + + 400000000000000ull, + 401000000000000ull, + 402000000000000ull, + 403000000000000ull, + 404000000000000ull, + 405000000000000ull, + 406000000000000ull, + 407000000000000ull, + 408000000000000ull, + 409000000000000ull, + 480000000000000ull, + 481000000000000ull, + 804000000000000ull, + 805000000000000ull, + 884000000000000ull, + 885000000000000ull, + + 410000000000000ull, + 411000000000000ull, + 412000000000000ull, + 413000000000000ull, + 414000000000000ull, + 415000000000000ull, + 416000000000000ull, + 417000000000000ull, + 418000000000000ull, + 419000000000000ull, + 490000000000000ull, + 491000000000000ull, + 814000000000000ull, + 815000000000000ull, + 894000000000000ull, + 895000000000000ull, + + 420000000000000ull, + 421000000000000ull, + 422000000000000ull, + 423000000000000ull, + 424000000000000ull, + 425000000000000ull, + 426000000000000ull, + 427000000000000ull, + 428000000000000ull, + 429000000000000ull, + 482000000000000ull, + 483000000000000ull, + 824000000000000ull, + 825000000000000ull, + 848000000000000ull, + 849000000000000ull, + + 430000000000000ull, + 431000000000000ull, + 432000000000000ull, + 433000000000000ull, + 434000000000000ull, + 435000000000000ull, + 436000000000000ull, + 437000000000000ull, + 438000000000000ull, + 439000000000000ull, + 492000000000000ull, + 493000000000000ull, + 834000000000000ull, + 835000000000000ull, + 858000000000000ull, + 859000000000000ull, + + 440000000000000ull, + 441000000000000ull, + 442000000000000ull, + 443000000000000ull, + 444000000000000ull, + 445000000000000ull, + 446000000000000ull, + 447000000000000ull, + 448000000000000ull, + 449000000000000ull, + 484000000000000ull, + 485000000000000ull, + 844000000000000ull, + 845000000000000ull, + 488000000000000ull, + 489000000000000ull, + + 450000000000000ull, + 451000000000000ull, + 452000000000000ull, + 453000000000000ull, + 454000000000000ull, + 455000000000000ull, + 456000000000000ull, + 457000000000000ull, + 458000000000000ull, + 459000000000000ull, + 494000000000000ull, + 495000000000000ull, + 854000000000000ull, + 855000000000000ull, + 498000000000000ull, + 499000000000000ull, + + 460000000000000ull, + 461000000000000ull, + 462000000000000ull, + 463000000000000ull, + 464000000000000ull, + 465000000000000ull, + 466000000000000ull, + 467000000000000ull, + 468000000000000ull, + 469000000000000ull, + 486000000000000ull, + 487000000000000ull, + 864000000000000ull, + 865000000000000ull, + 888000000000000ull, + 889000000000000ull, + + 470000000000000ull, + 471000000000000ull, + 472000000000000ull, + 473000000000000ull, + 474000000000000ull, + 475000000000000ull, + 476000000000000ull, + 477000000000000ull, + 478000000000000ull, + 479000000000000ull, + 496000000000000ull, + 497000000000000ull, + 874000000000000ull, + 875000000000000ull, + 898000000000000ull, + 899000000000000ull, + + 500000000000000ull, + 501000000000000ull, + 502000000000000ull, + 503000000000000ull, + 504000000000000ull, + 505000000000000ull, + 506000000000000ull, + 507000000000000ull, + 508000000000000ull, + 509000000000000ull, + 580000000000000ull, + 581000000000000ull, + 904000000000000ull, + 905000000000000ull, + 984000000000000ull, + 985000000000000ull, + + 510000000000000ull, + 511000000000000ull, + 512000000000000ull, + 513000000000000ull, + 514000000000000ull, + 515000000000000ull, + 516000000000000ull, + 517000000000000ull, + 518000000000000ull, + 519000000000000ull, + 590000000000000ull, + 591000000000000ull, + 914000000000000ull, + 915000000000000ull, + 994000000000000ull, + 995000000000000ull, + + 520000000000000ull, + 521000000000000ull, + 522000000000000ull, + 523000000000000ull, + 524000000000000ull, + 525000000000000ull, + 526000000000000ull, + 527000000000000ull, + 528000000000000ull, + 529000000000000ull, + 582000000000000ull, + 583000000000000ull, + 924000000000000ull, + 925000000000000ull, + 948000000000000ull, + 949000000000000ull, + + 530000000000000ull, + 531000000000000ull, + 532000000000000ull, + 533000000000000ull, + 534000000000000ull, + 535000000000000ull, + 536000000000000ull, + 537000000000000ull, + 538000000000000ull, + 539000000000000ull, + 592000000000000ull, + 593000000000000ull, + 934000000000000ull, + 935000000000000ull, + 958000000000000ull, + 959000000000000ull, + + 540000000000000ull, + 541000000000000ull, + 542000000000000ull, + 543000000000000ull, + 544000000000000ull, + 545000000000000ull, + 546000000000000ull, + 547000000000000ull, + 548000000000000ull, + 549000000000000ull, + 584000000000000ull, + 585000000000000ull, + 944000000000000ull, + 945000000000000ull, + 588000000000000ull, + 589000000000000ull, + + 550000000000000ull, + 551000000000000ull, + 552000000000000ull, + 553000000000000ull, + 554000000000000ull, + 555000000000000ull, + 556000000000000ull, + 557000000000000ull, + 558000000000000ull, + 559000000000000ull, + 594000000000000ull, + 595000000000000ull, + 954000000000000ull, + 955000000000000ull, + 598000000000000ull, + 599000000000000ull, + + 560000000000000ull, + 561000000000000ull, + 562000000000000ull, + 563000000000000ull, + 564000000000000ull, + 565000000000000ull, + 566000000000000ull, + 567000000000000ull, + 568000000000000ull, + 569000000000000ull, + 586000000000000ull, + 587000000000000ull, + 964000000000000ull, + 965000000000000ull, + 988000000000000ull, + 989000000000000ull, + + 570000000000000ull, + 571000000000000ull, + 572000000000000ull, + 573000000000000ull, + 574000000000000ull, + 575000000000000ull, + 576000000000000ull, + 577000000000000ull, + 578000000000000ull, + 579000000000000ull, + 596000000000000ull, + 597000000000000ull, + 974000000000000ull, + 975000000000000ull, + 998000000000000ull, + 999000000000000ull, + + 600000000000000ull, + 601000000000000ull, + 602000000000000ull, + 603000000000000ull, + 604000000000000ull, + 605000000000000ull, + 606000000000000ull, + 607000000000000ull, + 608000000000000ull, + 609000000000000ull, + 680000000000000ull, + 681000000000000ull, + 806000000000000ull, + 807000000000000ull, + 886000000000000ull, + 887000000000000ull, + + 610000000000000ull, + 611000000000000ull, + 612000000000000ull, + 613000000000000ull, + 614000000000000ull, + 615000000000000ull, + 616000000000000ull, + 617000000000000ull, + 618000000000000ull, + 619000000000000ull, + 690000000000000ull, + 691000000000000ull, + 816000000000000ull, + 817000000000000ull, + 896000000000000ull, + 897000000000000ull, + + 620000000000000ull, + 621000000000000ull, + 622000000000000ull, + 623000000000000ull, + 624000000000000ull, + 625000000000000ull, + 626000000000000ull, + 627000000000000ull, + 628000000000000ull, + 629000000000000ull, + 682000000000000ull, + 683000000000000ull, + 826000000000000ull, + 827000000000000ull, + 868000000000000ull, + 869000000000000ull, + + 630000000000000ull, + 631000000000000ull, + 632000000000000ull, + 633000000000000ull, + 634000000000000ull, + 635000000000000ull, + 636000000000000ull, + 637000000000000ull, + 638000000000000ull, + 639000000000000ull, + 692000000000000ull, + 693000000000000ull, + 836000000000000ull, + 837000000000000ull, + 878000000000000ull, + 879000000000000ull, + + 640000000000000ull, + 641000000000000ull, + 642000000000000ull, + 643000000000000ull, + 644000000000000ull, + 645000000000000ull, + 646000000000000ull, + 647000000000000ull, + 648000000000000ull, + 649000000000000ull, + 684000000000000ull, + 685000000000000ull, + 846000000000000ull, + 847000000000000ull, + 688000000000000ull, + 689000000000000ull, + + 650000000000000ull, + 651000000000000ull, + 652000000000000ull, + 653000000000000ull, + 654000000000000ull, + 655000000000000ull, + 656000000000000ull, + 657000000000000ull, + 658000000000000ull, + 659000000000000ull, + 694000000000000ull, + 695000000000000ull, + 856000000000000ull, + 857000000000000ull, + 698000000000000ull, + 699000000000000ull, + + 660000000000000ull, + 661000000000000ull, + 662000000000000ull, + 663000000000000ull, + 664000000000000ull, + 665000000000000ull, + 666000000000000ull, + 667000000000000ull, + 668000000000000ull, + 669000000000000ull, + 686000000000000ull, + 687000000000000ull, + 866000000000000ull, + 867000000000000ull, + 888000000000000ull, + 889000000000000ull, + + 670000000000000ull, + 671000000000000ull, + 672000000000000ull, + 673000000000000ull, + 674000000000000ull, + 675000000000000ull, + 676000000000000ull, + 677000000000000ull, + 678000000000000ull, + 679000000000000ull, + 696000000000000ull, + 697000000000000ull, + 876000000000000ull, + 877000000000000ull, + 898000000000000ull, + 899000000000000ull, + + 700000000000000ull, + 701000000000000ull, + 702000000000000ull, + 703000000000000ull, + 704000000000000ull, + 705000000000000ull, + 706000000000000ull, + 707000000000000ull, + 708000000000000ull, + 709000000000000ull, + 780000000000000ull, + 781000000000000ull, + 906000000000000ull, + 907000000000000ull, + 986000000000000ull, + 987000000000000ull, + + 710000000000000ull, + 711000000000000ull, + 712000000000000ull, + 713000000000000ull, + 714000000000000ull, + 715000000000000ull, + 716000000000000ull, + 717000000000000ull, + 718000000000000ull, + 719000000000000ull, + 790000000000000ull, + 791000000000000ull, + 916000000000000ull, + 917000000000000ull, + 996000000000000ull, + 997000000000000ull, + + 720000000000000ull, + 721000000000000ull, + 722000000000000ull, + 723000000000000ull, + 724000000000000ull, + 725000000000000ull, + 726000000000000ull, + 727000000000000ull, + 728000000000000ull, + 729000000000000ull, + 782000000000000ull, + 783000000000000ull, + 926000000000000ull, + 927000000000000ull, + 968000000000000ull, + 969000000000000ull, + + 730000000000000ull, + 731000000000000ull, + 732000000000000ull, + 733000000000000ull, + 734000000000000ull, + 735000000000000ull, + 736000000000000ull, + 737000000000000ull, + 738000000000000ull, + 739000000000000ull, + 792000000000000ull, + 793000000000000ull, + 936000000000000ull, + 937000000000000ull, + 978000000000000ull, + 979000000000000ull, + + 740000000000000ull, + 741000000000000ull, + 742000000000000ull, + 743000000000000ull, + 744000000000000ull, + 745000000000000ull, + 746000000000000ull, + 747000000000000ull, + 748000000000000ull, + 749000000000000ull, + 784000000000000ull, + 785000000000000ull, + 946000000000000ull, + 947000000000000ull, + 788000000000000ull, + 789000000000000ull, + + 750000000000000ull, + 751000000000000ull, + 752000000000000ull, + 753000000000000ull, + 754000000000000ull, + 755000000000000ull, + 756000000000000ull, + 757000000000000ull, + 758000000000000ull, + 759000000000000ull, + 794000000000000ull, + 795000000000000ull, + 956000000000000ull, + 957000000000000ull, + 798000000000000ull, + 799000000000000ull, + + 760000000000000ull, + 761000000000000ull, + 762000000000000ull, + 763000000000000ull, + 764000000000000ull, + 765000000000000ull, + 766000000000000ull, + 767000000000000ull, + 768000000000000ull, + 769000000000000ull, + 786000000000000ull, + 787000000000000ull, + 966000000000000ull, + 967000000000000ull, + 988000000000000ull, + 989000000000000ull, + + 770000000000000ull, + 771000000000000ull, + 772000000000000ull, + 773000000000000ull, + 774000000000000ull, + 775000000000000ull, + 776000000000000ull, + 777000000000000ull, + 778000000000000ull, + 779000000000000ull, + 796000000000000ull, + 797000000000000ull, + 976000000000000ull, + 977000000000000ull, + 998000000000000ull, + 999000000000000ull +}; + +static const UINT64 d2b6[] = { + 0000000000000000ull, + 1000000000000000ull, + 2000000000000000ull, + 3000000000000000ull, + 4000000000000000ull, + 5000000000000000ull, + 6000000000000000ull, + 7000000000000000ull, + 8000000000000000ull, + 9000000000000000ull, + 80000000000000000ull, + 81000000000000000ull, + 800000000000000000ull, + 801000000000000000ull, + 880000000000000000ull, + 881000000000000000ull, + + 10000000000000000ull, + 11000000000000000ull, + 12000000000000000ull, + 13000000000000000ull, + 14000000000000000ull, + 15000000000000000ull, + 16000000000000000ull, + 17000000000000000ull, + 18000000000000000ull, + 19000000000000000ull, + 90000000000000000ull, + 91000000000000000ull, + 810000000000000000ull, + 811000000000000000ull, + 890000000000000000ull, + 891000000000000000ull, + + 20000000000000000ull, + 21000000000000000ull, + 22000000000000000ull, + 23000000000000000ull, + 24000000000000000ull, + 25000000000000000ull, + 26000000000000000ull, + 27000000000000000ull, + 28000000000000000ull, + 29000000000000000ull, + 82000000000000000ull, + 83000000000000000ull, + 820000000000000000ull, + 821000000000000000ull, + 808000000000000000ull, + 809000000000000000ull, + + 30000000000000000ull, + 31000000000000000ull, + 32000000000000000ull, + 33000000000000000ull, + 34000000000000000ull, + 35000000000000000ull, + 36000000000000000ull, + 37000000000000000ull, + 38000000000000000ull, + 39000000000000000ull, + 92000000000000000ull, + 93000000000000000ull, + 830000000000000000ull, + 831000000000000000ull, + 818000000000000000ull, + 819000000000000000ull, + + 40000000000000000ull, + 41000000000000000ull, + 42000000000000000ull, + 43000000000000000ull, + 44000000000000000ull, + 45000000000000000ull, + 46000000000000000ull, + 47000000000000000ull, + 48000000000000000ull, + 49000000000000000ull, + 84000000000000000ull, + 85000000000000000ull, + 840000000000000000ull, + 841000000000000000ull, + 88000000000000000ull, + 89000000000000000ull, + + 50000000000000000ull, + 51000000000000000ull, + 52000000000000000ull, + 53000000000000000ull, + 54000000000000000ull, + 55000000000000000ull, + 56000000000000000ull, + 57000000000000000ull, + 58000000000000000ull, + 59000000000000000ull, + 94000000000000000ull, + 95000000000000000ull, + 850000000000000000ull, + 851000000000000000ull, + 98000000000000000ull, + 99000000000000000ull, + + 60000000000000000ull, + 61000000000000000ull, + 62000000000000000ull, + 63000000000000000ull, + 64000000000000000ull, + 65000000000000000ull, + 66000000000000000ull, + 67000000000000000ull, + 68000000000000000ull, + 69000000000000000ull, + 86000000000000000ull, + 87000000000000000ull, + 860000000000000000ull, + 861000000000000000ull, + 888000000000000000ull, + 889000000000000000ull, + + 70000000000000000ull, + 71000000000000000ull, + 72000000000000000ull, + 73000000000000000ull, + 74000000000000000ull, + 75000000000000000ull, + 76000000000000000ull, + 77000000000000000ull, + 78000000000000000ull, + 79000000000000000ull, + 96000000000000000ull, + 97000000000000000ull, + 870000000000000000ull, + 871000000000000000ull, + 898000000000000000ull, + 899000000000000000ull, + + 100000000000000000ull, + 101000000000000000ull, + 102000000000000000ull, + 103000000000000000ull, + 104000000000000000ull, + 105000000000000000ull, + 106000000000000000ull, + 107000000000000000ull, + 108000000000000000ull, + 109000000000000000ull, + 180000000000000000ull, + 181000000000000000ull, + 900000000000000000ull, + 901000000000000000ull, + 980000000000000000ull, + 981000000000000000ull, + + 110000000000000000ull, + 111000000000000000ull, + 112000000000000000ull, + 113000000000000000ull, + 114000000000000000ull, + 115000000000000000ull, + 116000000000000000ull, + 117000000000000000ull, + 118000000000000000ull, + 119000000000000000ull, + 190000000000000000ull, + 191000000000000000ull, + 910000000000000000ull, + 911000000000000000ull, + 990000000000000000ull, + 991000000000000000ull, + + 120000000000000000ull, + 121000000000000000ull, + 122000000000000000ull, + 123000000000000000ull, + 124000000000000000ull, + 125000000000000000ull, + 126000000000000000ull, + 127000000000000000ull, + 128000000000000000ull, + 129000000000000000ull, + 182000000000000000ull, + 183000000000000000ull, + 920000000000000000ull, + 921000000000000000ull, + 908000000000000000ull, + 909000000000000000ull, + + 130000000000000000ull, + 131000000000000000ull, + 132000000000000000ull, + 133000000000000000ull, + 134000000000000000ull, + 135000000000000000ull, + 136000000000000000ull, + 137000000000000000ull, + 138000000000000000ull, + 139000000000000000ull, + 192000000000000000ull, + 193000000000000000ull, + 930000000000000000ull, + 931000000000000000ull, + 918000000000000000ull, + 919000000000000000ull, + + 140000000000000000ull, + 141000000000000000ull, + 142000000000000000ull, + 143000000000000000ull, + 144000000000000000ull, + 145000000000000000ull, + 146000000000000000ull, + 147000000000000000ull, + 148000000000000000ull, + 149000000000000000ull, + 184000000000000000ull, + 185000000000000000ull, + 940000000000000000ull, + 941000000000000000ull, + 188000000000000000ull, + 189000000000000000ull, + + 150000000000000000ull, + 151000000000000000ull, + 152000000000000000ull, + 153000000000000000ull, + 154000000000000000ull, + 155000000000000000ull, + 156000000000000000ull, + 157000000000000000ull, + 158000000000000000ull, + 159000000000000000ull, + 194000000000000000ull, + 195000000000000000ull, + 950000000000000000ull, + 951000000000000000ull, + 198000000000000000ull, + 199000000000000000ull, + + 160000000000000000ull, + 161000000000000000ull, + 162000000000000000ull, + 163000000000000000ull, + 164000000000000000ull, + 165000000000000000ull, + 166000000000000000ull, + 167000000000000000ull, + 168000000000000000ull, + 169000000000000000ull, + 186000000000000000ull, + 187000000000000000ull, + 960000000000000000ull, + 961000000000000000ull, + 988000000000000000ull, + 989000000000000000ull, + + 170000000000000000ull, + 171000000000000000ull, + 172000000000000000ull, + 173000000000000000ull, + 174000000000000000ull, + 175000000000000000ull, + 176000000000000000ull, + 177000000000000000ull, + 178000000000000000ull, + 179000000000000000ull, + 196000000000000000ull, + 197000000000000000ull, + 970000000000000000ull, + 971000000000000000ull, + 998000000000000000ull, + 999000000000000000ull, + + 200000000000000000ull, + 201000000000000000ull, + 202000000000000000ull, + 203000000000000000ull, + 204000000000000000ull, + 205000000000000000ull, + 206000000000000000ull, + 207000000000000000ull, + 208000000000000000ull, + 209000000000000000ull, + 280000000000000000ull, + 281000000000000000ull, + 802000000000000000ull, + 803000000000000000ull, + 882000000000000000ull, + 883000000000000000ull, + + 210000000000000000ull, + 211000000000000000ull, + 212000000000000000ull, + 213000000000000000ull, + 214000000000000000ull, + 215000000000000000ull, + 216000000000000000ull, + 217000000000000000ull, + 218000000000000000ull, + 219000000000000000ull, + 290000000000000000ull, + 291000000000000000ull, + 812000000000000000ull, + 813000000000000000ull, + 892000000000000000ull, + 893000000000000000ull, + + 220000000000000000ull, + 221000000000000000ull, + 222000000000000000ull, + 223000000000000000ull, + 224000000000000000ull, + 225000000000000000ull, + 226000000000000000ull, + 227000000000000000ull, + 228000000000000000ull, + 229000000000000000ull, + 282000000000000000ull, + 283000000000000000ull, + 822000000000000000ull, + 823000000000000000ull, + 828000000000000000ull, + 829000000000000000ull, + + 230000000000000000ull, + 231000000000000000ull, + 232000000000000000ull, + 233000000000000000ull, + 234000000000000000ull, + 235000000000000000ull, + 236000000000000000ull, + 237000000000000000ull, + 238000000000000000ull, + 239000000000000000ull, + 292000000000000000ull, + 293000000000000000ull, + 832000000000000000ull, + 833000000000000000ull, + 838000000000000000ull, + 839000000000000000ull, + + 240000000000000000ull, + 241000000000000000ull, + 242000000000000000ull, + 243000000000000000ull, + 244000000000000000ull, + 245000000000000000ull, + 246000000000000000ull, + 247000000000000000ull, + 248000000000000000ull, + 249000000000000000ull, + 284000000000000000ull, + 285000000000000000ull, + 842000000000000000ull, + 843000000000000000ull, + 288000000000000000ull, + 289000000000000000ull, + + 250000000000000000ull, + 251000000000000000ull, + 252000000000000000ull, + 253000000000000000ull, + 254000000000000000ull, + 255000000000000000ull, + 256000000000000000ull, + 257000000000000000ull, + 258000000000000000ull, + 259000000000000000ull, + 294000000000000000ull, + 295000000000000000ull, + 852000000000000000ull, + 853000000000000000ull, + 298000000000000000ull, + 299000000000000000ull, + + 260000000000000000ull, + 261000000000000000ull, + 262000000000000000ull, + 263000000000000000ull, + 264000000000000000ull, + 265000000000000000ull, + 266000000000000000ull, + 267000000000000000ull, + 268000000000000000ull, + 269000000000000000ull, + 286000000000000000ull, + 287000000000000000ull, + 862000000000000000ull, + 863000000000000000ull, + 888000000000000000ull, + 889000000000000000ull, + + 270000000000000000ull, + 271000000000000000ull, + 272000000000000000ull, + 273000000000000000ull, + 274000000000000000ull, + 275000000000000000ull, + 276000000000000000ull, + 277000000000000000ull, + 278000000000000000ull, + 279000000000000000ull, + 296000000000000000ull, + 297000000000000000ull, + 872000000000000000ull, + 873000000000000000ull, + 898000000000000000ull, + 899000000000000000ull, + + 300000000000000000ull, + 301000000000000000ull, + 302000000000000000ull, + 303000000000000000ull, + 304000000000000000ull, + 305000000000000000ull, + 306000000000000000ull, + 307000000000000000ull, + 308000000000000000ull, + 309000000000000000ull, + 380000000000000000ull, + 381000000000000000ull, + 902000000000000000ull, + 903000000000000000ull, + 982000000000000000ull, + 983000000000000000ull, + + 310000000000000000ull, + 311000000000000000ull, + 312000000000000000ull, + 313000000000000000ull, + 314000000000000000ull, + 315000000000000000ull, + 316000000000000000ull, + 317000000000000000ull, + 318000000000000000ull, + 319000000000000000ull, + 390000000000000000ull, + 391000000000000000ull, + 912000000000000000ull, + 913000000000000000ull, + 992000000000000000ull, + 993000000000000000ull, + + 320000000000000000ull, + 321000000000000000ull, + 322000000000000000ull, + 323000000000000000ull, + 324000000000000000ull, + 325000000000000000ull, + 326000000000000000ull, + 327000000000000000ull, + 328000000000000000ull, + 329000000000000000ull, + 382000000000000000ull, + 383000000000000000ull, + 922000000000000000ull, + 923000000000000000ull, + 928000000000000000ull, + 929000000000000000ull, + + 330000000000000000ull, + 331000000000000000ull, + 332000000000000000ull, + 333000000000000000ull, + 334000000000000000ull, + 335000000000000000ull, + 336000000000000000ull, + 337000000000000000ull, + 338000000000000000ull, + 339000000000000000ull, + 392000000000000000ull, + 393000000000000000ull, + 932000000000000000ull, + 933000000000000000ull, + 938000000000000000ull, + 939000000000000000ull, + + 340000000000000000ull, + 341000000000000000ull, + 342000000000000000ull, + 343000000000000000ull, + 344000000000000000ull, + 345000000000000000ull, + 346000000000000000ull, + 347000000000000000ull, + 348000000000000000ull, + 349000000000000000ull, + 384000000000000000ull, + 385000000000000000ull, + 942000000000000000ull, + 943000000000000000ull, + 388000000000000000ull, + 389000000000000000ull, + + 350000000000000000ull, + 351000000000000000ull, + 352000000000000000ull, + 353000000000000000ull, + 354000000000000000ull, + 355000000000000000ull, + 356000000000000000ull, + 357000000000000000ull, + 358000000000000000ull, + 359000000000000000ull, + 394000000000000000ull, + 395000000000000000ull, + 952000000000000000ull, + 953000000000000000ull, + 398000000000000000ull, + 399000000000000000ull, + + 360000000000000000ull, + 361000000000000000ull, + 362000000000000000ull, + 363000000000000000ull, + 364000000000000000ull, + 365000000000000000ull, + 366000000000000000ull, + 367000000000000000ull, + 368000000000000000ull, + 369000000000000000ull, + 386000000000000000ull, + 387000000000000000ull, + 962000000000000000ull, + 963000000000000000ull, + 988000000000000000ull, + 989000000000000000ull, + + 370000000000000000ull, + 371000000000000000ull, + 372000000000000000ull, + 373000000000000000ull, + 374000000000000000ull, + 375000000000000000ull, + 376000000000000000ull, + 377000000000000000ull, + 378000000000000000ull, + 379000000000000000ull, + 396000000000000000ull, + 397000000000000000ull, + 972000000000000000ull, + 973000000000000000ull, + 998000000000000000ull, + 999000000000000000ull, + + 400000000000000000ull, + 401000000000000000ull, + 402000000000000000ull, + 403000000000000000ull, + 404000000000000000ull, + 405000000000000000ull, + 406000000000000000ull, + 407000000000000000ull, + 408000000000000000ull, + 409000000000000000ull, + 480000000000000000ull, + 481000000000000000ull, + 804000000000000000ull, + 805000000000000000ull, + 884000000000000000ull, + 885000000000000000ull, + + 410000000000000000ull, + 411000000000000000ull, + 412000000000000000ull, + 413000000000000000ull, + 414000000000000000ull, + 415000000000000000ull, + 416000000000000000ull, + 417000000000000000ull, + 418000000000000000ull, + 419000000000000000ull, + 490000000000000000ull, + 491000000000000000ull, + 814000000000000000ull, + 815000000000000000ull, + 894000000000000000ull, + 895000000000000000ull, + + 420000000000000000ull, + 421000000000000000ull, + 422000000000000000ull, + 423000000000000000ull, + 424000000000000000ull, + 425000000000000000ull, + 426000000000000000ull, + 427000000000000000ull, + 428000000000000000ull, + 429000000000000000ull, + 482000000000000000ull, + 483000000000000000ull, + 824000000000000000ull, + 825000000000000000ull, + 848000000000000000ull, + 849000000000000000ull, + + 430000000000000000ull, + 431000000000000000ull, + 432000000000000000ull, + 433000000000000000ull, + 434000000000000000ull, + 435000000000000000ull, + 436000000000000000ull, + 437000000000000000ull, + 438000000000000000ull, + 439000000000000000ull, + 492000000000000000ull, + 493000000000000000ull, + 834000000000000000ull, + 835000000000000000ull, + 858000000000000000ull, + 859000000000000000ull, + + 440000000000000000ull, + 441000000000000000ull, + 442000000000000000ull, + 443000000000000000ull, + 444000000000000000ull, + 445000000000000000ull, + 446000000000000000ull, + 447000000000000000ull, + 448000000000000000ull, + 449000000000000000ull, + 484000000000000000ull, + 485000000000000000ull, + 844000000000000000ull, + 845000000000000000ull, + 488000000000000000ull, + 489000000000000000ull, + + 450000000000000000ull, + 451000000000000000ull, + 452000000000000000ull, + 453000000000000000ull, + 454000000000000000ull, + 455000000000000000ull, + 456000000000000000ull, + 457000000000000000ull, + 458000000000000000ull, + 459000000000000000ull, + 494000000000000000ull, + 495000000000000000ull, + 854000000000000000ull, + 855000000000000000ull, + 498000000000000000ull, + 499000000000000000ull, + + 460000000000000000ull, + 461000000000000000ull, + 462000000000000000ull, + 463000000000000000ull, + 464000000000000000ull, + 465000000000000000ull, + 466000000000000000ull, + 467000000000000000ull, + 468000000000000000ull, + 469000000000000000ull, + 486000000000000000ull, + 487000000000000000ull, + 864000000000000000ull, + 865000000000000000ull, + 888000000000000000ull, + 889000000000000000ull, + + 470000000000000000ull, + 471000000000000000ull, + 472000000000000000ull, + 473000000000000000ull, + 474000000000000000ull, + 475000000000000000ull, + 476000000000000000ull, + 477000000000000000ull, + 478000000000000000ull, + 479000000000000000ull, + 496000000000000000ull, + 497000000000000000ull, + 874000000000000000ull, + 875000000000000000ull, + 898000000000000000ull, + 899000000000000000ull, + + 500000000000000000ull, + 501000000000000000ull, + 502000000000000000ull, + 503000000000000000ull, + 504000000000000000ull, + 505000000000000000ull, + 506000000000000000ull, + 507000000000000000ull, + 508000000000000000ull, + 509000000000000000ull, + 580000000000000000ull, + 581000000000000000ull, + 904000000000000000ull, + 905000000000000000ull, + 984000000000000000ull, + 985000000000000000ull, + + 510000000000000000ull, + 511000000000000000ull, + 512000000000000000ull, + 513000000000000000ull, + 514000000000000000ull, + 515000000000000000ull, + 516000000000000000ull, + 517000000000000000ull, + 518000000000000000ull, + 519000000000000000ull, + 590000000000000000ull, + 591000000000000000ull, + 914000000000000000ull, + 915000000000000000ull, + 994000000000000000ull, + 995000000000000000ull, + + 520000000000000000ull, + 521000000000000000ull, + 522000000000000000ull, + 523000000000000000ull, + 524000000000000000ull, + 525000000000000000ull, + 526000000000000000ull, + 527000000000000000ull, + 528000000000000000ull, + 529000000000000000ull, + 582000000000000000ull, + 583000000000000000ull, + 924000000000000000ull, + 925000000000000000ull, + 948000000000000000ull, + 949000000000000000ull, + + 530000000000000000ull, + 531000000000000000ull, + 532000000000000000ull, + 533000000000000000ull, + 534000000000000000ull, + 535000000000000000ull, + 536000000000000000ull, + 537000000000000000ull, + 538000000000000000ull, + 539000000000000000ull, + 592000000000000000ull, + 593000000000000000ull, + 934000000000000000ull, + 935000000000000000ull, + 958000000000000000ull, + 959000000000000000ull, + + 540000000000000000ull, + 541000000000000000ull, + 542000000000000000ull, + 543000000000000000ull, + 544000000000000000ull, + 545000000000000000ull, + 546000000000000000ull, + 547000000000000000ull, + 548000000000000000ull, + 549000000000000000ull, + 584000000000000000ull, + 585000000000000000ull, + 944000000000000000ull, + 945000000000000000ull, + 588000000000000000ull, + 589000000000000000ull, + + 550000000000000000ull, + 551000000000000000ull, + 552000000000000000ull, + 553000000000000000ull, + 554000000000000000ull, + 555000000000000000ull, + 556000000000000000ull, + 557000000000000000ull, + 558000000000000000ull, + 559000000000000000ull, + 594000000000000000ull, + 595000000000000000ull, + 954000000000000000ull, + 955000000000000000ull, + 598000000000000000ull, + 599000000000000000ull, + + 560000000000000000ull, + 561000000000000000ull, + 562000000000000000ull, + 563000000000000000ull, + 564000000000000000ull, + 565000000000000000ull, + 566000000000000000ull, + 567000000000000000ull, + 568000000000000000ull, + 569000000000000000ull, + 586000000000000000ull, + 587000000000000000ull, + 964000000000000000ull, + 965000000000000000ull, + 988000000000000000ull, + 989000000000000000ull, + + 570000000000000000ull, + 571000000000000000ull, + 572000000000000000ull, + 573000000000000000ull, + 574000000000000000ull, + 575000000000000000ull, + 576000000000000000ull, + 577000000000000000ull, + 578000000000000000ull, + 579000000000000000ull, + 596000000000000000ull, + 597000000000000000ull, + 974000000000000000ull, + 975000000000000000ull, + 998000000000000000ull, + 999000000000000000ull, + + 600000000000000000ull, + 601000000000000000ull, + 602000000000000000ull, + 603000000000000000ull, + 604000000000000000ull, + 605000000000000000ull, + 606000000000000000ull, + 607000000000000000ull, + 608000000000000000ull, + 609000000000000000ull, + 680000000000000000ull, + 681000000000000000ull, + 806000000000000000ull, + 807000000000000000ull, + 886000000000000000ull, + 887000000000000000ull, + + 610000000000000000ull, + 611000000000000000ull, + 612000000000000000ull, + 613000000000000000ull, + 614000000000000000ull, + 615000000000000000ull, + 616000000000000000ull, + 617000000000000000ull, + 618000000000000000ull, + 619000000000000000ull, + 690000000000000000ull, + 691000000000000000ull, + 816000000000000000ull, + 817000000000000000ull, + 896000000000000000ull, + 897000000000000000ull, + + 620000000000000000ull, + 621000000000000000ull, + 622000000000000000ull, + 623000000000000000ull, + 624000000000000000ull, + 625000000000000000ull, + 626000000000000000ull, + 627000000000000000ull, + 628000000000000000ull, + 629000000000000000ull, + 682000000000000000ull, + 683000000000000000ull, + 826000000000000000ull, + 827000000000000000ull, + 868000000000000000ull, + 869000000000000000ull, + + 630000000000000000ull, + 631000000000000000ull, + 632000000000000000ull, + 633000000000000000ull, + 634000000000000000ull, + 635000000000000000ull, + 636000000000000000ull, + 637000000000000000ull, + 638000000000000000ull, + 639000000000000000ull, + 692000000000000000ull, + 693000000000000000ull, + 836000000000000000ull, + 837000000000000000ull, + 878000000000000000ull, + 879000000000000000ull, + + 640000000000000000ull, + 641000000000000000ull, + 642000000000000000ull, + 643000000000000000ull, + 644000000000000000ull, + 645000000000000000ull, + 646000000000000000ull, + 647000000000000000ull, + 648000000000000000ull, + 649000000000000000ull, + 684000000000000000ull, + 685000000000000000ull, + 846000000000000000ull, + 847000000000000000ull, + 688000000000000000ull, + 689000000000000000ull, + + 650000000000000000ull, + 651000000000000000ull, + 652000000000000000ull, + 653000000000000000ull, + 654000000000000000ull, + 655000000000000000ull, + 656000000000000000ull, + 657000000000000000ull, + 658000000000000000ull, + 659000000000000000ull, + 694000000000000000ull, + 695000000000000000ull, + 856000000000000000ull, + 857000000000000000ull, + 698000000000000000ull, + 699000000000000000ull, + + 660000000000000000ull, + 661000000000000000ull, + 662000000000000000ull, + 663000000000000000ull, + 664000000000000000ull, + 665000000000000000ull, + 666000000000000000ull, + 667000000000000000ull, + 668000000000000000ull, + 669000000000000000ull, + 686000000000000000ull, + 687000000000000000ull, + 866000000000000000ull, + 867000000000000000ull, + 888000000000000000ull, + 889000000000000000ull, + + 670000000000000000ull, + 671000000000000000ull, + 672000000000000000ull, + 673000000000000000ull, + 674000000000000000ull, + 675000000000000000ull, + 676000000000000000ull, + 677000000000000000ull, + 678000000000000000ull, + 679000000000000000ull, + 696000000000000000ull, + 697000000000000000ull, + 876000000000000000ull, + 877000000000000000ull, + 898000000000000000ull, + 899000000000000000ull, + + 700000000000000000ull, + 701000000000000000ull, + 702000000000000000ull, + 703000000000000000ull, + 704000000000000000ull, + 705000000000000000ull, + 706000000000000000ull, + 707000000000000000ull, + 708000000000000000ull, + 709000000000000000ull, + 780000000000000000ull, + 781000000000000000ull, + 906000000000000000ull, + 907000000000000000ull, + 986000000000000000ull, + 987000000000000000ull, + + 710000000000000000ull, + 711000000000000000ull, + 712000000000000000ull, + 713000000000000000ull, + 714000000000000000ull, + 715000000000000000ull, + 716000000000000000ull, + 717000000000000000ull, + 718000000000000000ull, + 719000000000000000ull, + 790000000000000000ull, + 791000000000000000ull, + 916000000000000000ull, + 917000000000000000ull, + 996000000000000000ull, + 997000000000000000ull, + + 720000000000000000ull, + 721000000000000000ull, + 722000000000000000ull, + 723000000000000000ull, + 724000000000000000ull, + 725000000000000000ull, + 726000000000000000ull, + 727000000000000000ull, + 728000000000000000ull, + 729000000000000000ull, + 782000000000000000ull, + 783000000000000000ull, + 926000000000000000ull, + 927000000000000000ull, + 968000000000000000ull, + 969000000000000000ull, + + 730000000000000000ull, + 731000000000000000ull, + 732000000000000000ull, + 733000000000000000ull, + 734000000000000000ull, + 735000000000000000ull, + 736000000000000000ull, + 737000000000000000ull, + 738000000000000000ull, + 739000000000000000ull, + 792000000000000000ull, + 793000000000000000ull, + 936000000000000000ull, + 937000000000000000ull, + 978000000000000000ull, + 979000000000000000ull, + + 740000000000000000ull, + 741000000000000000ull, + 742000000000000000ull, + 743000000000000000ull, + 744000000000000000ull, + 745000000000000000ull, + 746000000000000000ull, + 747000000000000000ull, + 748000000000000000ull, + 749000000000000000ull, + 784000000000000000ull, + 785000000000000000ull, + 946000000000000000ull, + 947000000000000000ull, + 788000000000000000ull, + 789000000000000000ull, + + 750000000000000000ull, + 751000000000000000ull, + 752000000000000000ull, + 753000000000000000ull, + 754000000000000000ull, + 755000000000000000ull, + 756000000000000000ull, + 757000000000000000ull, + 758000000000000000ull, + 759000000000000000ull, + 794000000000000000ull, + 795000000000000000ull, + 956000000000000000ull, + 957000000000000000ull, + 798000000000000000ull, + 799000000000000000ull, + + 760000000000000000ull, + 761000000000000000ull, + 762000000000000000ull, + 763000000000000000ull, + 764000000000000000ull, + 765000000000000000ull, + 766000000000000000ull, + 767000000000000000ull, + 768000000000000000ull, + 769000000000000000ull, + 786000000000000000ull, + 787000000000000000ull, + 966000000000000000ull, + 967000000000000000ull, + 988000000000000000ull, + 989000000000000000ull, + + 770000000000000000ull, + 771000000000000000ull, + 772000000000000000ull, + 773000000000000000ull, + 774000000000000000ull, + 775000000000000000ull, + 776000000000000000ull, + 777000000000000000ull, + 778000000000000000ull, + 779000000000000000ull, + 796000000000000000ull, + 797000000000000000ull, + 976000000000000000ull, + 977000000000000000ull, + 998000000000000000ull, + 999000000000000000ull +}; + +static const UINT64 b2d[] = { + 0x000ull, + 0x001ull, + 0x002ull, + 0x003ull, + 0x004ull, + 0x005ull, + 0x006ull, + 0x007ull, + 0x008ull, + 0x009ull, + + 0x010ull, + 0x011ull, + 0x012ull, + 0x013ull, + 0x014ull, + 0x015ull, + 0x016ull, + 0x017ull, + 0x018ull, + 0x019ull, + + 0x020ull, + 0x021ull, + 0x022ull, + 0x023ull, + 0x024ull, + 0x025ull, + 0x026ull, + 0x027ull, + 0x028ull, + 0x029ull, + + 0x030ull, + 0x031ull, + 0x032ull, + 0x033ull, + 0x034ull, + 0x035ull, + 0x036ull, + 0x037ull, + 0x038ull, + 0x039ull, + + 0x040ull, + 0x041ull, + 0x042ull, + 0x043ull, + 0x044ull, + 0x045ull, + 0x046ull, + 0x047ull, + 0x048ull, + 0x049ull, + + 0x050ull, + 0x051ull, + 0x052ull, + 0x053ull, + 0x054ull, + 0x055ull, + 0x056ull, + 0x057ull, + 0x058ull, + 0x059ull, + + 0x060ull, + 0x061ull, + 0x062ull, + 0x063ull, + 0x064ull, + 0x065ull, + 0x066ull, + 0x067ull, + 0x068ull, + 0x069ull, + + 0x070ull, + 0x071ull, + 0x072ull, + 0x073ull, + 0x074ull, + 0x075ull, + 0x076ull, + 0x077ull, + 0x078ull, + 0x079ull, + + 0x00aull, + 0x00bull, + 0x02aull, + 0x02bull, + 0x04aull, + 0x04bull, + 0x06aull, + 0x06bull, + 0x04eull, + 0x04full, + + 0x01aull, + 0x01bull, + 0x03aull, + 0x03bull, + 0x05aull, + 0x05bull, + 0x07aull, + 0x07bull, + 0x05eull, + 0x05full, + + 0x080ull, + 0x081ull, + 0x082ull, + 0x083ull, + 0x084ull, + 0x085ull, + 0x086ull, + 0x087ull, + 0x088ull, + 0x089ull, + + 0x090ull, + 0x091ull, + 0x092ull, + 0x093ull, + 0x094ull, + 0x095ull, + 0x096ull, + 0x097ull, + 0x098ull, + 0x099ull, + + 0x0a0ull, + 0x0a1ull, + 0x0a2ull, + 0x0a3ull, + 0x0a4ull, + 0x0a5ull, + 0x0a6ull, + 0x0a7ull, + 0x0a8ull, + 0x0a9ull, + + 0x0b0ull, + 0x0b1ull, + 0x0b2ull, + 0x0b3ull, + 0x0b4ull, + 0x0b5ull, + 0x0b6ull, + 0x0b7ull, + 0x0b8ull, + 0x0b9ull, + + 0x0c0ull, + 0x0c1ull, + 0x0c2ull, + 0x0c3ull, + 0x0c4ull, + 0x0c5ull, + 0x0c6ull, + 0x0c7ull, + 0x0c8ull, + 0x0c9ull, + + 0x0d0ull, + 0x0d1ull, + 0x0d2ull, + 0x0d3ull, + 0x0d4ull, + 0x0d5ull, + 0x0d6ull, + 0x0d7ull, + 0x0d8ull, + 0x0d9ull, + + 0x0e0ull, + 0x0e1ull, + 0x0e2ull, + 0x0e3ull, + 0x0e4ull, + 0x0e5ull, + 0x0e6ull, + 0x0e7ull, + 0x0e8ull, + 0x0e9ull, + + 0x0f0ull, + 0x0f1ull, + 0x0f2ull, + 0x0f3ull, + 0x0f4ull, + 0x0f5ull, + 0x0f6ull, + 0x0f7ull, + 0x0f8ull, + 0x0f9ull, + + 0x08aull, + 0x08bull, + 0x0aaull, + 0x0abull, + 0x0caull, + 0x0cbull, + 0x0eaull, + 0x0ebull, + 0x0ceull, + 0x0cfull, + + 0x09aull, + 0x09bull, + 0x0baull, + 0x0bbull, + 0x0daull, + 0x0dbull, + 0x0faull, + 0x0fbull, + 0x0deull, + 0x0dfull, + + 0x100ull, + 0x101ull, + 0x102ull, + 0x103ull, + 0x104ull, + 0x105ull, + 0x106ull, + 0x107ull, + 0x108ull, + 0x109ull, + + 0x110ull, + 0x111ull, + 0x112ull, + 0x113ull, + 0x114ull, + 0x115ull, + 0x116ull, + 0x117ull, + 0x118ull, + 0x119ull, + + 0x120ull, + 0x121ull, + 0x122ull, + 0x123ull, + 0x124ull, + 0x125ull, + 0x126ull, + 0x127ull, + 0x128ull, + 0x129ull, + + 0x130ull, + 0x131ull, + 0x132ull, + 0x133ull, + 0x134ull, + 0x135ull, + 0x136ull, + 0x137ull, + 0x138ull, + 0x139ull, + + 0x140ull, + 0x141ull, + 0x142ull, + 0x143ull, + 0x144ull, + 0x145ull, + 0x146ull, + 0x147ull, + 0x148ull, + 0x149ull, + + 0x150ull, + 0x151ull, + 0x152ull, + 0x153ull, + 0x154ull, + 0x155ull, + 0x156ull, + 0x157ull, + 0x158ull, + 0x159ull, + + 0x160ull, + 0x161ull, + 0x162ull, + 0x163ull, + 0x164ull, + 0x165ull, + 0x166ull, + 0x167ull, + 0x168ull, + 0x169ull, + + 0x170ull, + 0x171ull, + 0x172ull, + 0x173ull, + 0x174ull, + 0x175ull, + 0x176ull, + 0x177ull, + 0x178ull, + 0x179ull, + + 0x10aull, + 0x10bull, + 0x12aull, + 0x12bull, + 0x14aull, + 0x14bull, + 0x16aull, + 0x16bull, + 0x14eull, + 0x14full, + + 0x11aull, + 0x11bull, + 0x13aull, + 0x13bull, + 0x15aull, + 0x15bull, + 0x17aull, + 0x17bull, + 0x15eull, + 0x15full, + + 0x180ull, + 0x181ull, + 0x182ull, + 0x183ull, + 0x184ull, + 0x185ull, + 0x186ull, + 0x187ull, + 0x188ull, + 0x189ull, + + 0x190ull, + 0x191ull, + 0x192ull, + 0x193ull, + 0x194ull, + 0x195ull, + 0x196ull, + 0x197ull, + 0x198ull, + 0x199ull, + + 0x1a0ull, + 0x1a1ull, + 0x1a2ull, + 0x1a3ull, + 0x1a4ull, + 0x1a5ull, + 0x1a6ull, + 0x1a7ull, + 0x1a8ull, + 0x1a9ull, + + 0x1b0ull, + 0x1b1ull, + 0x1b2ull, + 0x1b3ull, + 0x1b4ull, + 0x1b5ull, + 0x1b6ull, + 0x1b7ull, + 0x1b8ull, + 0x1b9ull, + + 0x1c0ull, + 0x1c1ull, + 0x1c2ull, + 0x1c3ull, + 0x1c4ull, + 0x1c5ull, + 0x1c6ull, + 0x1c7ull, + 0x1c8ull, + 0x1c9ull, + + 0x1d0ull, + 0x1d1ull, + 0x1d2ull, + 0x1d3ull, + 0x1d4ull, + 0x1d5ull, + 0x1d6ull, + 0x1d7ull, + 0x1d8ull, + 0x1d9ull, + + 0x1e0ull, + 0x1e1ull, + 0x1e2ull, + 0x1e3ull, + 0x1e4ull, + 0x1e5ull, + 0x1e6ull, + 0x1e7ull, + 0x1e8ull, + 0x1e9ull, + + 0x1f0ull, + 0x1f1ull, + 0x1f2ull, + 0x1f3ull, + 0x1f4ull, + 0x1f5ull, + 0x1f6ull, + 0x1f7ull, + 0x1f8ull, + 0x1f9ull, + + 0x18aull, + 0x18bull, + 0x1aaull, + 0x1abull, + 0x1caull, + 0x1cbull, + 0x1eaull, + 0x1ebull, + 0x1ceull, + 0x1cfull, + + 0x19aull, + 0x19bull, + 0x1baull, + 0x1bbull, + 0x1daull, + 0x1dbull, + 0x1faull, + 0x1fbull, + 0x1deull, + 0x1dfull, + + 0x200ull, + 0x201ull, + 0x202ull, + 0x203ull, + 0x204ull, + 0x205ull, + 0x206ull, + 0x207ull, + 0x208ull, + 0x209ull, + + 0x210ull, + 0x211ull, + 0x212ull, + 0x213ull, + 0x214ull, + 0x215ull, + 0x216ull, + 0x217ull, + 0x218ull, + 0x219ull, + + 0x220ull, + 0x221ull, + 0x222ull, + 0x223ull, + 0x224ull, + 0x225ull, + 0x226ull, + 0x227ull, + 0x228ull, + 0x229ull, + + 0x230ull, + 0x231ull, + 0x232ull, + 0x233ull, + 0x234ull, + 0x235ull, + 0x236ull, + 0x237ull, + 0x238ull, + 0x239ull, + + 0x240ull, + 0x241ull, + 0x242ull, + 0x243ull, + 0x244ull, + 0x245ull, + 0x246ull, + 0x247ull, + 0x248ull, + 0x249ull, + + 0x250ull, + 0x251ull, + 0x252ull, + 0x253ull, + 0x254ull, + 0x255ull, + 0x256ull, + 0x257ull, + 0x258ull, + 0x259ull, + + 0x260ull, + 0x261ull, + 0x262ull, + 0x263ull, + 0x264ull, + 0x265ull, + 0x266ull, + 0x267ull, + 0x268ull, + 0x269ull, + + 0x270ull, + 0x271ull, + 0x272ull, + 0x273ull, + 0x274ull, + 0x275ull, + 0x276ull, + 0x277ull, + 0x278ull, + 0x279ull, + + 0x20aull, + 0x20bull, + 0x22aull, + 0x22bull, + 0x24aull, + 0x24bull, + 0x26aull, + 0x26bull, + 0x24eull, + 0x24full, + + 0x21aull, + 0x21bull, + 0x23aull, + 0x23bull, + 0x25aull, + 0x25bull, + 0x27aull, + 0x27bull, + 0x25eull, + 0x25full, + + 0x280ull, + 0x281ull, + 0x282ull, + 0x283ull, + 0x284ull, + 0x285ull, + 0x286ull, + 0x287ull, + 0x288ull, + 0x289ull, + + 0x290ull, + 0x291ull, + 0x292ull, + 0x293ull, + 0x294ull, + 0x295ull, + 0x296ull, + 0x297ull, + 0x298ull, + 0x299ull, + + 0x2a0ull, + 0x2a1ull, + 0x2a2ull, + 0x2a3ull, + 0x2a4ull, + 0x2a5ull, + 0x2a6ull, + 0x2a7ull, + 0x2a8ull, + 0x2a9ull, + + 0x2b0ull, + 0x2b1ull, + 0x2b2ull, + 0x2b3ull, + 0x2b4ull, + 0x2b5ull, + 0x2b6ull, + 0x2b7ull, + 0x2b8ull, + 0x2b9ull, + + 0x2c0ull, + 0x2c1ull, + 0x2c2ull, + 0x2c3ull, + 0x2c4ull, + 0x2c5ull, + 0x2c6ull, + 0x2c7ull, + 0x2c8ull, + 0x2c9ull, + + 0x2d0ull, + 0x2d1ull, + 0x2d2ull, + 0x2d3ull, + 0x2d4ull, + 0x2d5ull, + 0x2d6ull, + 0x2d7ull, + 0x2d8ull, + 0x2d9ull, + + 0x2e0ull, + 0x2e1ull, + 0x2e2ull, + 0x2e3ull, + 0x2e4ull, + 0x2e5ull, + 0x2e6ull, + 0x2e7ull, + 0x2e8ull, + 0x2e9ull, + + 0x2f0ull, + 0x2f1ull, + 0x2f2ull, + 0x2f3ull, + 0x2f4ull, + 0x2f5ull, + 0x2f6ull, + 0x2f7ull, + 0x2f8ull, + 0x2f9ull, + + 0x28aull, + 0x28bull, + 0x2aaull, + 0x2abull, + 0x2caull, + 0x2cbull, + 0x2eaull, + 0x2ebull, + 0x2ceull, + 0x2cfull, + + 0x29aull, + 0x29bull, + 0x2baull, + 0x2bbull, + 0x2daull, + 0x2dbull, + 0x2faull, + 0x2fbull, + 0x2deull, + 0x2dfull, + + 0x300ull, + 0x301ull, + 0x302ull, + 0x303ull, + 0x304ull, + 0x305ull, + 0x306ull, + 0x307ull, + 0x308ull, + 0x309ull, + + 0x310ull, + 0x311ull, + 0x312ull, + 0x313ull, + 0x314ull, + 0x315ull, + 0x316ull, + 0x317ull, + 0x318ull, + 0x319ull, + + 0x320ull, + 0x321ull, + 0x322ull, + 0x323ull, + 0x324ull, + 0x325ull, + 0x326ull, + 0x327ull, + 0x328ull, + 0x329ull, + + 0x330ull, + 0x331ull, + 0x332ull, + 0x333ull, + 0x334ull, + 0x335ull, + 0x336ull, + 0x337ull, + 0x338ull, + 0x339ull, + + 0x340ull, + 0x341ull, + 0x342ull, + 0x343ull, + 0x344ull, + 0x345ull, + 0x346ull, + 0x347ull, + 0x348ull, + 0x349ull, + + 0x350ull, + 0x351ull, + 0x352ull, + 0x353ull, + 0x354ull, + 0x355ull, + 0x356ull, + 0x357ull, + 0x358ull, + 0x359ull, + + 0x360ull, + 0x361ull, + 0x362ull, + 0x363ull, + 0x364ull, + 0x365ull, + 0x366ull, + 0x367ull, + 0x368ull, + 0x369ull, + + 0x370ull, + 0x371ull, + 0x372ull, + 0x373ull, + 0x374ull, + 0x375ull, + 0x376ull, + 0x377ull, + 0x378ull, + 0x379ull, + + 0x30aull, + 0x30bull, + 0x32aull, + 0x32bull, + 0x34aull, + 0x34bull, + 0x36aull, + 0x36bull, + 0x34eull, + 0x34full, + + 0x31aull, + 0x31bull, + 0x33aull, + 0x33bull, + 0x35aull, + 0x35bull, + 0x37aull, + 0x37bull, + 0x35eull, + 0x35full, + + 0x380ull, + 0x381ull, + 0x382ull, + 0x383ull, + 0x384ull, + 0x385ull, + 0x386ull, + 0x387ull, + 0x388ull, + 0x389ull, + + 0x390ull, + 0x391ull, + 0x392ull, + 0x393ull, + 0x394ull, + 0x395ull, + 0x396ull, + 0x397ull, + 0x398ull, + 0x399ull, + + 0x3a0ull, + 0x3a1ull, + 0x3a2ull, + 0x3a3ull, + 0x3a4ull, + 0x3a5ull, + 0x3a6ull, + 0x3a7ull, + 0x3a8ull, + 0x3a9ull, + + 0x3b0ull, + 0x3b1ull, + 0x3b2ull, + 0x3b3ull, + 0x3b4ull, + 0x3b5ull, + 0x3b6ull, + 0x3b7ull, + 0x3b8ull, + 0x3b9ull, + + 0x3c0ull, + 0x3c1ull, + 0x3c2ull, + 0x3c3ull, + 0x3c4ull, + 0x3c5ull, + 0x3c6ull, + 0x3c7ull, + 0x3c8ull, + 0x3c9ull, + + 0x3d0ull, + 0x3d1ull, + 0x3d2ull, + 0x3d3ull, + 0x3d4ull, + 0x3d5ull, + 0x3d6ull, + 0x3d7ull, + 0x3d8ull, + 0x3d9ull, + + 0x3e0ull, + 0x3e1ull, + 0x3e2ull, + 0x3e3ull, + 0x3e4ull, + 0x3e5ull, + 0x3e6ull, + 0x3e7ull, + 0x3e8ull, + 0x3e9ull, + + 0x3f0ull, + 0x3f1ull, + 0x3f2ull, + 0x3f3ull, + 0x3f4ull, + 0x3f5ull, + 0x3f6ull, + 0x3f7ull, + 0x3f8ull, + 0x3f9ull, + + 0x38aull, + 0x38bull, + 0x3aaull, + 0x3abull, + 0x3caull, + 0x3cbull, + 0x3eaull, + 0x3ebull, + 0x3ceull, + 0x3cfull, + + 0x39aull, + 0x39bull, + 0x3baull, + 0x3bbull, + 0x3daull, + 0x3dbull, + 0x3faull, + 0x3fbull, + 0x3deull, + 0x3dfull, + + 0x00cull, + 0x00dull, + 0x10cull, + 0x10dull, + 0x20cull, + 0x20dull, + 0x30cull, + 0x30dull, + 0x02eull, + 0x02full, + + 0x01cull, + 0x01dull, + 0x11cull, + 0x11dull, + 0x21cull, + 0x21dull, + 0x31cull, + 0x31dull, + 0x03eull, + 0x03full, + + 0x02cull, + 0x02dull, + 0x12cull, + 0x12dull, + 0x22cull, + 0x22dull, + 0x32cull, + 0x32dull, + 0x12eull, + 0x12full, + + 0x03cull, + 0x03dull, + 0x13cull, + 0x13dull, + 0x23cull, + 0x23dull, + 0x33cull, + 0x33dull, + 0x13eull, + 0x13full, + + 0x04cull, + 0x04dull, + 0x14cull, + 0x14dull, + 0x24cull, + 0x24dull, + 0x34cull, + 0x34dull, + 0x22eull, + 0x22full, + + 0x05cull, + 0x05dull, + 0x15cull, + 0x15dull, + 0x25cull, + 0x25dull, + 0x35cull, + 0x35dull, + 0x23eull, + 0x23full, + + 0x06cull, + 0x06dull, + 0x16cull, + 0x16dull, + 0x26cull, + 0x26dull, + 0x36cull, + 0x36dull, + 0x32eull, + 0x32full, + + 0x07cull, + 0x07dull, + 0x17cull, + 0x17dull, + 0x27cull, + 0x27dull, + 0x37cull, + 0x37dull, + 0x33eull, + 0x33full, + + 0x00eull, + 0x00full, + 0x10eull, + 0x10full, + 0x20eull, + 0x20full, + 0x30eull, + 0x30full, + 0x06eull, + 0x06full, + + 0x01eull, + 0x01full, + 0x11eull, + 0x11full, + 0x21eull, + 0x21full, + 0x31eull, + 0x31full, + 0x07eull, + 0x07full, + + 0x08cull, + 0x08dull, + 0x18cull, + 0x18dull, + 0x28cull, + 0x28dull, + 0x38cull, + 0x38dull, + 0x0aeull, + 0x0afull, + + 0x09cull, + 0x09dull, + 0x19cull, + 0x19dull, + 0x29cull, + 0x29dull, + 0x39cull, + 0x39dull, + 0x0beull, + 0x0bfull, + + 0x0acull, + 0x0adull, + 0x1acull, + 0x1adull, + 0x2acull, + 0x2adull, + 0x3acull, + 0x3adull, + 0x1aeull, + 0x1afull, + + 0x0bcull, + 0x0bdull, + 0x1bcull, + 0x1bdull, + 0x2bcull, + 0x2bdull, + 0x3bcull, + 0x3bdull, + 0x1beull, + 0x1bfull, + + 0x0ccull, + 0x0cdull, + 0x1ccull, + 0x1cdull, + 0x2ccull, + 0x2cdull, + 0x3ccull, + 0x3cdull, + 0x2aeull, + 0x2afull, + + 0x0dcull, + 0x0ddull, + 0x1dcull, + 0x1ddull, + 0x2dcull, + 0x2ddull, + 0x3dcull, + 0x3ddull, + 0x2beull, + 0x2bfull, + + 0x0ecull, + 0x0edull, + 0x1ecull, + 0x1edull, + 0x2ecull, + 0x2edull, + 0x3ecull, + 0x3edull, + 0x3aeull, + 0x3afull, + + 0x0fcull, + 0x0fdull, + 0x1fcull, + 0x1fdull, + 0x2fcull, + 0x2fdull, + 0x3fcull, + 0x3fdull, + 0x3beull, + 0x3bfull, + + 0x08eull, + 0x08full, + 0x18eull, + 0x18full, + 0x28eull, + 0x28full, + 0x38eull, + 0x38full, + 0x0eeull, + 0x0efull, + + 0x09eull, + 0x09full, + 0x19eull, + 0x19full, + 0x29eull, + 0x29full, + 0x39eull, + 0x39full, + 0x0feull, + 0x0ffull +}; + +static const UINT64 b2d2[] = { + 0x000ull << 10, + 0x001ull << 10, + 0x002ull << 10, + 0x003ull << 10, + 0x004ull << 10, + 0x005ull << 10, + 0x006ull << 10, + 0x007ull << 10, + 0x008ull << 10, + 0x009ull << 10, + + 0x010ull << 10, + 0x011ull << 10, + 0x012ull << 10, + 0x013ull << 10, + 0x014ull << 10, + 0x015ull << 10, + 0x016ull << 10, + 0x017ull << 10, + 0x018ull << 10, + 0x019ull << 10, + + 0x020ull << 10, + 0x021ull << 10, + 0x022ull << 10, + 0x023ull << 10, + 0x024ull << 10, + 0x025ull << 10, + 0x026ull << 10, + 0x027ull << 10, + 0x028ull << 10, + 0x029ull << 10, + + 0x030ull << 10, + 0x031ull << 10, + 0x032ull << 10, + 0x033ull << 10, + 0x034ull << 10, + 0x035ull << 10, + 0x036ull << 10, + 0x037ull << 10, + 0x038ull << 10, + 0x039ull << 10, + + 0x040ull << 10, + 0x041ull << 10, + 0x042ull << 10, + 0x043ull << 10, + 0x044ull << 10, + 0x045ull << 10, + 0x046ull << 10, + 0x047ull << 10, + 0x048ull << 10, + 0x049ull << 10, + + 0x050ull << 10, + 0x051ull << 10, + 0x052ull << 10, + 0x053ull << 10, + 0x054ull << 10, + 0x055ull << 10, + 0x056ull << 10, + 0x057ull << 10, + 0x058ull << 10, + 0x059ull << 10, + + 0x060ull << 10, + 0x061ull << 10, + 0x062ull << 10, + 0x063ull << 10, + 0x064ull << 10, + 0x065ull << 10, + 0x066ull << 10, + 0x067ull << 10, + 0x068ull << 10, + 0x069ull << 10, + + 0x070ull << 10, + 0x071ull << 10, + 0x072ull << 10, + 0x073ull << 10, + 0x074ull << 10, + 0x075ull << 10, + 0x076ull << 10, + 0x077ull << 10, + 0x078ull << 10, + 0x079ull << 10, + + 0x00aull << 10, + 0x00bull << 10, + 0x02aull << 10, + 0x02bull << 10, + 0x04aull << 10, + 0x04bull << 10, + 0x06aull << 10, + 0x06bull << 10, + 0x04eull << 10, + 0x04full << 10, + + 0x01aull << 10, + 0x01bull << 10, + 0x03aull << 10, + 0x03bull << 10, + 0x05aull << 10, + 0x05bull << 10, + 0x07aull << 10, + 0x07bull << 10, + 0x05eull << 10, + 0x05full << 10, + + 0x080ull << 10, + 0x081ull << 10, + 0x082ull << 10, + 0x083ull << 10, + 0x084ull << 10, + 0x085ull << 10, + 0x086ull << 10, + 0x087ull << 10, + 0x088ull << 10, + 0x089ull << 10, + + 0x090ull << 10, + 0x091ull << 10, + 0x092ull << 10, + 0x093ull << 10, + 0x094ull << 10, + 0x095ull << 10, + 0x096ull << 10, + 0x097ull << 10, + 0x098ull << 10, + 0x099ull << 10, + + 0x0a0ull << 10, + 0x0a1ull << 10, + 0x0a2ull << 10, + 0x0a3ull << 10, + 0x0a4ull << 10, + 0x0a5ull << 10, + 0x0a6ull << 10, + 0x0a7ull << 10, + 0x0a8ull << 10, + 0x0a9ull << 10, + + 0x0b0ull << 10, + 0x0b1ull << 10, + 0x0b2ull << 10, + 0x0b3ull << 10, + 0x0b4ull << 10, + 0x0b5ull << 10, + 0x0b6ull << 10, + 0x0b7ull << 10, + 0x0b8ull << 10, + 0x0b9ull << 10, + + 0x0c0ull << 10, + 0x0c1ull << 10, + 0x0c2ull << 10, + 0x0c3ull << 10, + 0x0c4ull << 10, + 0x0c5ull << 10, + 0x0c6ull << 10, + 0x0c7ull << 10, + 0x0c8ull << 10, + 0x0c9ull << 10, + + 0x0d0ull << 10, + 0x0d1ull << 10, + 0x0d2ull << 10, + 0x0d3ull << 10, + 0x0d4ull << 10, + 0x0d5ull << 10, + 0x0d6ull << 10, + 0x0d7ull << 10, + 0x0d8ull << 10, + 0x0d9ull << 10, + + 0x0e0ull << 10, + 0x0e1ull << 10, + 0x0e2ull << 10, + 0x0e3ull << 10, + 0x0e4ull << 10, + 0x0e5ull << 10, + 0x0e6ull << 10, + 0x0e7ull << 10, + 0x0e8ull << 10, + 0x0e9ull << 10, + + 0x0f0ull << 10, + 0x0f1ull << 10, + 0x0f2ull << 10, + 0x0f3ull << 10, + 0x0f4ull << 10, + 0x0f5ull << 10, + 0x0f6ull << 10, + 0x0f7ull << 10, + 0x0f8ull << 10, + 0x0f9ull << 10, + + 0x08aull << 10, + 0x08bull << 10, + 0x0aaull << 10, + 0x0abull << 10, + 0x0caull << 10, + 0x0cbull << 10, + 0x0eaull << 10, + 0x0ebull << 10, + 0x0ceull << 10, + 0x0cfull << 10, + + 0x09aull << 10, + 0x09bull << 10, + 0x0baull << 10, + 0x0bbull << 10, + 0x0daull << 10, + 0x0dbull << 10, + 0x0faull << 10, + 0x0fbull << 10, + 0x0deull << 10, + 0x0dfull << 10, + + 0x100ull << 10, + 0x101ull << 10, + 0x102ull << 10, + 0x103ull << 10, + 0x104ull << 10, + 0x105ull << 10, + 0x106ull << 10, + 0x107ull << 10, + 0x108ull << 10, + 0x109ull << 10, + + 0x110ull << 10, + 0x111ull << 10, + 0x112ull << 10, + 0x113ull << 10, + 0x114ull << 10, + 0x115ull << 10, + 0x116ull << 10, + 0x117ull << 10, + 0x118ull << 10, + 0x119ull << 10, + + 0x120ull << 10, + 0x121ull << 10, + 0x122ull << 10, + 0x123ull << 10, + 0x124ull << 10, + 0x125ull << 10, + 0x126ull << 10, + 0x127ull << 10, + 0x128ull << 10, + 0x129ull << 10, + + 0x130ull << 10, + 0x131ull << 10, + 0x132ull << 10, + 0x133ull << 10, + 0x134ull << 10, + 0x135ull << 10, + 0x136ull << 10, + 0x137ull << 10, + 0x138ull << 10, + 0x139ull << 10, + + 0x140ull << 10, + 0x141ull << 10, + 0x142ull << 10, + 0x143ull << 10, + 0x144ull << 10, + 0x145ull << 10, + 0x146ull << 10, + 0x147ull << 10, + 0x148ull << 10, + 0x149ull << 10, + + 0x150ull << 10, + 0x151ull << 10, + 0x152ull << 10, + 0x153ull << 10, + 0x154ull << 10, + 0x155ull << 10, + 0x156ull << 10, + 0x157ull << 10, + 0x158ull << 10, + 0x159ull << 10, + + 0x160ull << 10, + 0x161ull << 10, + 0x162ull << 10, + 0x163ull << 10, + 0x164ull << 10, + 0x165ull << 10, + 0x166ull << 10, + 0x167ull << 10, + 0x168ull << 10, + 0x169ull << 10, + + 0x170ull << 10, + 0x171ull << 10, + 0x172ull << 10, + 0x173ull << 10, + 0x174ull << 10, + 0x175ull << 10, + 0x176ull << 10, + 0x177ull << 10, + 0x178ull << 10, + 0x179ull << 10, + + 0x10aull << 10, + 0x10bull << 10, + 0x12aull << 10, + 0x12bull << 10, + 0x14aull << 10, + 0x14bull << 10, + 0x16aull << 10, + 0x16bull << 10, + 0x14eull << 10, + 0x14full << 10, + + 0x11aull << 10, + 0x11bull << 10, + 0x13aull << 10, + 0x13bull << 10, + 0x15aull << 10, + 0x15bull << 10, + 0x17aull << 10, + 0x17bull << 10, + 0x15eull << 10, + 0x15full << 10, + + 0x180ull << 10, + 0x181ull << 10, + 0x182ull << 10, + 0x183ull << 10, + 0x184ull << 10, + 0x185ull << 10, + 0x186ull << 10, + 0x187ull << 10, + 0x188ull << 10, + 0x189ull << 10, + + 0x190ull << 10, + 0x191ull << 10, + 0x192ull << 10, + 0x193ull << 10, + 0x194ull << 10, + 0x195ull << 10, + 0x196ull << 10, + 0x197ull << 10, + 0x198ull << 10, + 0x199ull << 10, + + 0x1a0ull << 10, + 0x1a1ull << 10, + 0x1a2ull << 10, + 0x1a3ull << 10, + 0x1a4ull << 10, + 0x1a5ull << 10, + 0x1a6ull << 10, + 0x1a7ull << 10, + 0x1a8ull << 10, + 0x1a9ull << 10, + + 0x1b0ull << 10, + 0x1b1ull << 10, + 0x1b2ull << 10, + 0x1b3ull << 10, + 0x1b4ull << 10, + 0x1b5ull << 10, + 0x1b6ull << 10, + 0x1b7ull << 10, + 0x1b8ull << 10, + 0x1b9ull << 10, + + 0x1c0ull << 10, + 0x1c1ull << 10, + 0x1c2ull << 10, + 0x1c3ull << 10, + 0x1c4ull << 10, + 0x1c5ull << 10, + 0x1c6ull << 10, + 0x1c7ull << 10, + 0x1c8ull << 10, + 0x1c9ull << 10, + + 0x1d0ull << 10, + 0x1d1ull << 10, + 0x1d2ull << 10, + 0x1d3ull << 10, + 0x1d4ull << 10, + 0x1d5ull << 10, + 0x1d6ull << 10, + 0x1d7ull << 10, + 0x1d8ull << 10, + 0x1d9ull << 10, + + 0x1e0ull << 10, + 0x1e1ull << 10, + 0x1e2ull << 10, + 0x1e3ull << 10, + 0x1e4ull << 10, + 0x1e5ull << 10, + 0x1e6ull << 10, + 0x1e7ull << 10, + 0x1e8ull << 10, + 0x1e9ull << 10, + + 0x1f0ull << 10, + 0x1f1ull << 10, + 0x1f2ull << 10, + 0x1f3ull << 10, + 0x1f4ull << 10, + 0x1f5ull << 10, + 0x1f6ull << 10, + 0x1f7ull << 10, + 0x1f8ull << 10, + 0x1f9ull << 10, + + 0x18aull << 10, + 0x18bull << 10, + 0x1aaull << 10, + 0x1abull << 10, + 0x1caull << 10, + 0x1cbull << 10, + 0x1eaull << 10, + 0x1ebull << 10, + 0x1ceull << 10, + 0x1cfull << 10, + + 0x19aull << 10, + 0x19bull << 10, + 0x1baull << 10, + 0x1bbull << 10, + 0x1daull << 10, + 0x1dbull << 10, + 0x1faull << 10, + 0x1fbull << 10, + 0x1deull << 10, + 0x1dfull << 10, + + 0x200ull << 10, + 0x201ull << 10, + 0x202ull << 10, + 0x203ull << 10, + 0x204ull << 10, + 0x205ull << 10, + 0x206ull << 10, + 0x207ull << 10, + 0x208ull << 10, + 0x209ull << 10, + + 0x210ull << 10, + 0x211ull << 10, + 0x212ull << 10, + 0x213ull << 10, + 0x214ull << 10, + 0x215ull << 10, + 0x216ull << 10, + 0x217ull << 10, + 0x218ull << 10, + 0x219ull << 10, + + 0x220ull << 10, + 0x221ull << 10, + 0x222ull << 10, + 0x223ull << 10, + 0x224ull << 10, + 0x225ull << 10, + 0x226ull << 10, + 0x227ull << 10, + 0x228ull << 10, + 0x229ull << 10, + + 0x230ull << 10, + 0x231ull << 10, + 0x232ull << 10, + 0x233ull << 10, + 0x234ull << 10, + 0x235ull << 10, + 0x236ull << 10, + 0x237ull << 10, + 0x238ull << 10, + 0x239ull << 10, + + 0x240ull << 10, + 0x241ull << 10, + 0x242ull << 10, + 0x243ull << 10, + 0x244ull << 10, + 0x245ull << 10, + 0x246ull << 10, + 0x247ull << 10, + 0x248ull << 10, + 0x249ull << 10, + + 0x250ull << 10, + 0x251ull << 10, + 0x252ull << 10, + 0x253ull << 10, + 0x254ull << 10, + 0x255ull << 10, + 0x256ull << 10, + 0x257ull << 10, + 0x258ull << 10, + 0x259ull << 10, + + 0x260ull << 10, + 0x261ull << 10, + 0x262ull << 10, + 0x263ull << 10, + 0x264ull << 10, + 0x265ull << 10, + 0x266ull << 10, + 0x267ull << 10, + 0x268ull << 10, + 0x269ull << 10, + + 0x270ull << 10, + 0x271ull << 10, + 0x272ull << 10, + 0x273ull << 10, + 0x274ull << 10, + 0x275ull << 10, + 0x276ull << 10, + 0x277ull << 10, + 0x278ull << 10, + 0x279ull << 10, + + 0x20aull << 10, + 0x20bull << 10, + 0x22aull << 10, + 0x22bull << 10, + 0x24aull << 10, + 0x24bull << 10, + 0x26aull << 10, + 0x26bull << 10, + 0x24eull << 10, + 0x24full << 10, + + 0x21aull << 10, + 0x21bull << 10, + 0x23aull << 10, + 0x23bull << 10, + 0x25aull << 10, + 0x25bull << 10, + 0x27aull << 10, + 0x27bull << 10, + 0x25eull << 10, + 0x25full << 10, + + 0x280ull << 10, + 0x281ull << 10, + 0x282ull << 10, + 0x283ull << 10, + 0x284ull << 10, + 0x285ull << 10, + 0x286ull << 10, + 0x287ull << 10, + 0x288ull << 10, + 0x289ull << 10, + + 0x290ull << 10, + 0x291ull << 10, + 0x292ull << 10, + 0x293ull << 10, + 0x294ull << 10, + 0x295ull << 10, + 0x296ull << 10, + 0x297ull << 10, + 0x298ull << 10, + 0x299ull << 10, + + 0x2a0ull << 10, + 0x2a1ull << 10, + 0x2a2ull << 10, + 0x2a3ull << 10, + 0x2a4ull << 10, + 0x2a5ull << 10, + 0x2a6ull << 10, + 0x2a7ull << 10, + 0x2a8ull << 10, + 0x2a9ull << 10, + + 0x2b0ull << 10, + 0x2b1ull << 10, + 0x2b2ull << 10, + 0x2b3ull << 10, + 0x2b4ull << 10, + 0x2b5ull << 10, + 0x2b6ull << 10, + 0x2b7ull << 10, + 0x2b8ull << 10, + 0x2b9ull << 10, + + 0x2c0ull << 10, + 0x2c1ull << 10, + 0x2c2ull << 10, + 0x2c3ull << 10, + 0x2c4ull << 10, + 0x2c5ull << 10, + 0x2c6ull << 10, + 0x2c7ull << 10, + 0x2c8ull << 10, + 0x2c9ull << 10, + + 0x2d0ull << 10, + 0x2d1ull << 10, + 0x2d2ull << 10, + 0x2d3ull << 10, + 0x2d4ull << 10, + 0x2d5ull << 10, + 0x2d6ull << 10, + 0x2d7ull << 10, + 0x2d8ull << 10, + 0x2d9ull << 10, + + 0x2e0ull << 10, + 0x2e1ull << 10, + 0x2e2ull << 10, + 0x2e3ull << 10, + 0x2e4ull << 10, + 0x2e5ull << 10, + 0x2e6ull << 10, + 0x2e7ull << 10, + 0x2e8ull << 10, + 0x2e9ull << 10, + + 0x2f0ull << 10, + 0x2f1ull << 10, + 0x2f2ull << 10, + 0x2f3ull << 10, + 0x2f4ull << 10, + 0x2f5ull << 10, + 0x2f6ull << 10, + 0x2f7ull << 10, + 0x2f8ull << 10, + 0x2f9ull << 10, + + 0x28aull << 10, + 0x28bull << 10, + 0x2aaull << 10, + 0x2abull << 10, + 0x2caull << 10, + 0x2cbull << 10, + 0x2eaull << 10, + 0x2ebull << 10, + 0x2ceull << 10, + 0x2cfull << 10, + + 0x29aull << 10, + 0x29bull << 10, + 0x2baull << 10, + 0x2bbull << 10, + 0x2daull << 10, + 0x2dbull << 10, + 0x2faull << 10, + 0x2fbull << 10, + 0x2deull << 10, + 0x2dfull << 10, + + 0x300ull << 10, + 0x301ull << 10, + 0x302ull << 10, + 0x303ull << 10, + 0x304ull << 10, + 0x305ull << 10, + 0x306ull << 10, + 0x307ull << 10, + 0x308ull << 10, + 0x309ull << 10, + + 0x310ull << 10, + 0x311ull << 10, + 0x312ull << 10, + 0x313ull << 10, + 0x314ull << 10, + 0x315ull << 10, + 0x316ull << 10, + 0x317ull << 10, + 0x318ull << 10, + 0x319ull << 10, + + 0x320ull << 10, + 0x321ull << 10, + 0x322ull << 10, + 0x323ull << 10, + 0x324ull << 10, + 0x325ull << 10, + 0x326ull << 10, + 0x327ull << 10, + 0x328ull << 10, + 0x329ull << 10, + + 0x330ull << 10, + 0x331ull << 10, + 0x332ull << 10, + 0x333ull << 10, + 0x334ull << 10, + 0x335ull << 10, + 0x336ull << 10, + 0x337ull << 10, + 0x338ull << 10, + 0x339ull << 10, + + 0x340ull << 10, + 0x341ull << 10, + 0x342ull << 10, + 0x343ull << 10, + 0x344ull << 10, + 0x345ull << 10, + 0x346ull << 10, + 0x347ull << 10, + 0x348ull << 10, + 0x349ull << 10, + + 0x350ull << 10, + 0x351ull << 10, + 0x352ull << 10, + 0x353ull << 10, + 0x354ull << 10, + 0x355ull << 10, + 0x356ull << 10, + 0x357ull << 10, + 0x358ull << 10, + 0x359ull << 10, + + 0x360ull << 10, + 0x361ull << 10, + 0x362ull << 10, + 0x363ull << 10, + 0x364ull << 10, + 0x365ull << 10, + 0x366ull << 10, + 0x367ull << 10, + 0x368ull << 10, + 0x369ull << 10, + + 0x370ull << 10, + 0x371ull << 10, + 0x372ull << 10, + 0x373ull << 10, + 0x374ull << 10, + 0x375ull << 10, + 0x376ull << 10, + 0x377ull << 10, + 0x378ull << 10, + 0x379ull << 10, + + 0x30aull << 10, + 0x30bull << 10, + 0x32aull << 10, + 0x32bull << 10, + 0x34aull << 10, + 0x34bull << 10, + 0x36aull << 10, + 0x36bull << 10, + 0x34eull << 10, + 0x34full << 10, + + 0x31aull << 10, + 0x31bull << 10, + 0x33aull << 10, + 0x33bull << 10, + 0x35aull << 10, + 0x35bull << 10, + 0x37aull << 10, + 0x37bull << 10, + 0x35eull << 10, + 0x35full << 10, + + 0x380ull << 10, + 0x381ull << 10, + 0x382ull << 10, + 0x383ull << 10, + 0x384ull << 10, + 0x385ull << 10, + 0x386ull << 10, + 0x387ull << 10, + 0x388ull << 10, + 0x389ull << 10, + + 0x390ull << 10, + 0x391ull << 10, + 0x392ull << 10, + 0x393ull << 10, + 0x394ull << 10, + 0x395ull << 10, + 0x396ull << 10, + 0x397ull << 10, + 0x398ull << 10, + 0x399ull << 10, + + 0x3a0ull << 10, + 0x3a1ull << 10, + 0x3a2ull << 10, + 0x3a3ull << 10, + 0x3a4ull << 10, + 0x3a5ull << 10, + 0x3a6ull << 10, + 0x3a7ull << 10, + 0x3a8ull << 10, + 0x3a9ull << 10, + + 0x3b0ull << 10, + 0x3b1ull << 10, + 0x3b2ull << 10, + 0x3b3ull << 10, + 0x3b4ull << 10, + 0x3b5ull << 10, + 0x3b6ull << 10, + 0x3b7ull << 10, + 0x3b8ull << 10, + 0x3b9ull << 10, + + 0x3c0ull << 10, + 0x3c1ull << 10, + 0x3c2ull << 10, + 0x3c3ull << 10, + 0x3c4ull << 10, + 0x3c5ull << 10, + 0x3c6ull << 10, + 0x3c7ull << 10, + 0x3c8ull << 10, + 0x3c9ull << 10, + + 0x3d0ull << 10, + 0x3d1ull << 10, + 0x3d2ull << 10, + 0x3d3ull << 10, + 0x3d4ull << 10, + 0x3d5ull << 10, + 0x3d6ull << 10, + 0x3d7ull << 10, + 0x3d8ull << 10, + 0x3d9ull << 10, + + 0x3e0ull << 10, + 0x3e1ull << 10, + 0x3e2ull << 10, + 0x3e3ull << 10, + 0x3e4ull << 10, + 0x3e5ull << 10, + 0x3e6ull << 10, + 0x3e7ull << 10, + 0x3e8ull << 10, + 0x3e9ull << 10, + + 0x3f0ull << 10, + 0x3f1ull << 10, + 0x3f2ull << 10, + 0x3f3ull << 10, + 0x3f4ull << 10, + 0x3f5ull << 10, + 0x3f6ull << 10, + 0x3f7ull << 10, + 0x3f8ull << 10, + 0x3f9ull << 10, + + 0x38aull << 10, + 0x38bull << 10, + 0x3aaull << 10, + 0x3abull << 10, + 0x3caull << 10, + 0x3cbull << 10, + 0x3eaull << 10, + 0x3ebull << 10, + 0x3ceull << 10, + 0x3cfull << 10, + + 0x39aull << 10, + 0x39bull << 10, + 0x3baull << 10, + 0x3bbull << 10, + 0x3daull << 10, + 0x3dbull << 10, + 0x3faull << 10, + 0x3fbull << 10, + 0x3deull << 10, + 0x3dfull << 10, + + 0x00cull << 10, + 0x00dull << 10, + 0x10cull << 10, + 0x10dull << 10, + 0x20cull << 10, + 0x20dull << 10, + 0x30cull << 10, + 0x30dull << 10, + 0x02eull << 10, + 0x02full << 10, + + 0x01cull << 10, + 0x01dull << 10, + 0x11cull << 10, + 0x11dull << 10, + 0x21cull << 10, + 0x21dull << 10, + 0x31cull << 10, + 0x31dull << 10, + 0x03eull << 10, + 0x03full << 10, + + 0x02cull << 10, + 0x02dull << 10, + 0x12cull << 10, + 0x12dull << 10, + 0x22cull << 10, + 0x22dull << 10, + 0x32cull << 10, + 0x32dull << 10, + 0x12eull << 10, + 0x12full << 10, + + 0x03cull << 10, + 0x03dull << 10, + 0x13cull << 10, + 0x13dull << 10, + 0x23cull << 10, + 0x23dull << 10, + 0x33cull << 10, + 0x33dull << 10, + 0x13eull << 10, + 0x13full << 10, + + 0x04cull << 10, + 0x04dull << 10, + 0x14cull << 10, + 0x14dull << 10, + 0x24cull << 10, + 0x24dull << 10, + 0x34cull << 10, + 0x34dull << 10, + 0x22eull << 10, + 0x22full << 10, + + 0x05cull << 10, + 0x05dull << 10, + 0x15cull << 10, + 0x15dull << 10, + 0x25cull << 10, + 0x25dull << 10, + 0x35cull << 10, + 0x35dull << 10, + 0x23eull << 10, + 0x23full << 10, + + 0x06cull << 10, + 0x06dull << 10, + 0x16cull << 10, + 0x16dull << 10, + 0x26cull << 10, + 0x26dull << 10, + 0x36cull << 10, + 0x36dull << 10, + 0x32eull << 10, + 0x32full << 10, + + 0x07cull << 10, + 0x07dull << 10, + 0x17cull << 10, + 0x17dull << 10, + 0x27cull << 10, + 0x27dull << 10, + 0x37cull << 10, + 0x37dull << 10, + 0x33eull << 10, + 0x33full << 10, + + 0x00eull << 10, + 0x00full << 10, + 0x10eull << 10, + 0x10full << 10, + 0x20eull << 10, + 0x20full << 10, + 0x30eull << 10, + 0x30full << 10, + 0x06eull << 10, + 0x06full << 10, + + 0x01eull << 10, + 0x01full << 10, + 0x11eull << 10, + 0x11full << 10, + 0x21eull << 10, + 0x21full << 10, + 0x31eull << 10, + 0x31full << 10, + 0x07eull << 10, + 0x07full << 10, + + 0x08cull << 10, + 0x08dull << 10, + 0x18cull << 10, + 0x18dull << 10, + 0x28cull << 10, + 0x28dull << 10, + 0x38cull << 10, + 0x38dull << 10, + 0x0aeull << 10, + 0x0afull << 10, + + 0x09cull << 10, + 0x09dull << 10, + 0x19cull << 10, + 0x19dull << 10, + 0x29cull << 10, + 0x29dull << 10, + 0x39cull << 10, + 0x39dull << 10, + 0x0beull << 10, + 0x0bfull << 10, + + 0x0acull << 10, + 0x0adull << 10, + 0x1acull << 10, + 0x1adull << 10, + 0x2acull << 10, + 0x2adull << 10, + 0x3acull << 10, + 0x3adull << 10, + 0x1aeull << 10, + 0x1afull << 10, + + 0x0bcull << 10, + 0x0bdull << 10, + 0x1bcull << 10, + 0x1bdull << 10, + 0x2bcull << 10, + 0x2bdull << 10, + 0x3bcull << 10, + 0x3bdull << 10, + 0x1beull << 10, + 0x1bfull << 10, + + 0x0ccull << 10, + 0x0cdull << 10, + 0x1ccull << 10, + 0x1cdull << 10, + 0x2ccull << 10, + 0x2cdull << 10, + 0x3ccull << 10, + 0x3cdull << 10, + 0x2aeull << 10, + 0x2afull << 10, + + 0x0dcull << 10, + 0x0ddull << 10, + 0x1dcull << 10, + 0x1ddull << 10, + 0x2dcull << 10, + 0x2ddull << 10, + 0x3dcull << 10, + 0x3ddull << 10, + 0x2beull << 10, + 0x2bfull << 10, + + 0x0ecull << 10, + 0x0edull << 10, + 0x1ecull << 10, + 0x1edull << 10, + 0x2ecull << 10, + 0x2edull << 10, + 0x3ecull << 10, + 0x3edull << 10, + 0x3aeull << 10, + 0x3afull << 10, + + 0x0fcull << 10, + 0x0fdull << 10, + 0x1fcull << 10, + 0x1fdull << 10, + 0x2fcull << 10, + 0x2fdull << 10, + 0x3fcull << 10, + 0x3fdull << 10, + 0x3beull << 10, + 0x3bfull << 10, + + 0x08eull << 10, + 0x08full << 10, + 0x18eull << 10, + 0x18full << 10, + 0x28eull << 10, + 0x28full << 10, + 0x38eull << 10, + 0x38full << 10, + 0x0eeull << 10, + 0x0efull << 10, + + 0x09eull << 10, + 0x09full << 10, + 0x19eull << 10, + 0x19full << 10, + 0x29eull << 10, + 0x29full << 10, + 0x39eull << 10, + 0x39full << 10, + 0x0feull << 10, + 0x0ffull << 10 +}; + +static const UINT64 b2d3[] = { + 0x000ull << 20, + 0x001ull << 20, + 0x002ull << 20, + 0x003ull << 20, + 0x004ull << 20, + 0x005ull << 20, + 0x006ull << 20, + 0x007ull << 20, + 0x008ull << 20, + 0x009ull << 20, + + 0x010ull << 20, + 0x011ull << 20, + 0x012ull << 20, + 0x013ull << 20, + 0x014ull << 20, + 0x015ull << 20, + 0x016ull << 20, + 0x017ull << 20, + 0x018ull << 20, + 0x019ull << 20, + + 0x020ull << 20, + 0x021ull << 20, + 0x022ull << 20, + 0x023ull << 20, + 0x024ull << 20, + 0x025ull << 20, + 0x026ull << 20, + 0x027ull << 20, + 0x028ull << 20, + 0x029ull << 20, + + 0x030ull << 20, + 0x031ull << 20, + 0x032ull << 20, + 0x033ull << 20, + 0x034ull << 20, + 0x035ull << 20, + 0x036ull << 20, + 0x037ull << 20, + 0x038ull << 20, + 0x039ull << 20, + + 0x040ull << 20, + 0x041ull << 20, + 0x042ull << 20, + 0x043ull << 20, + 0x044ull << 20, + 0x045ull << 20, + 0x046ull << 20, + 0x047ull << 20, + 0x048ull << 20, + 0x049ull << 20, + + 0x050ull << 20, + 0x051ull << 20, + 0x052ull << 20, + 0x053ull << 20, + 0x054ull << 20, + 0x055ull << 20, + 0x056ull << 20, + 0x057ull << 20, + 0x058ull << 20, + 0x059ull << 20, + + 0x060ull << 20, + 0x061ull << 20, + 0x062ull << 20, + 0x063ull << 20, + 0x064ull << 20, + 0x065ull << 20, + 0x066ull << 20, + 0x067ull << 20, + 0x068ull << 20, + 0x069ull << 20, + + 0x070ull << 20, + 0x071ull << 20, + 0x072ull << 20, + 0x073ull << 20, + 0x074ull << 20, + 0x075ull << 20, + 0x076ull << 20, + 0x077ull << 20, + 0x078ull << 20, + 0x079ull << 20, + + 0x00aull << 20, + 0x00bull << 20, + 0x02aull << 20, + 0x02bull << 20, + 0x04aull << 20, + 0x04bull << 20, + 0x06aull << 20, + 0x06bull << 20, + 0x04eull << 20, + 0x04full << 20, + + 0x01aull << 20, + 0x01bull << 20, + 0x03aull << 20, + 0x03bull << 20, + 0x05aull << 20, + 0x05bull << 20, + 0x07aull << 20, + 0x07bull << 20, + 0x05eull << 20, + 0x05full << 20, + + 0x080ull << 20, + 0x081ull << 20, + 0x082ull << 20, + 0x083ull << 20, + 0x084ull << 20, + 0x085ull << 20, + 0x086ull << 20, + 0x087ull << 20, + 0x088ull << 20, + 0x089ull << 20, + + 0x090ull << 20, + 0x091ull << 20, + 0x092ull << 20, + 0x093ull << 20, + 0x094ull << 20, + 0x095ull << 20, + 0x096ull << 20, + 0x097ull << 20, + 0x098ull << 20, + 0x099ull << 20, + + 0x0a0ull << 20, + 0x0a1ull << 20, + 0x0a2ull << 20, + 0x0a3ull << 20, + 0x0a4ull << 20, + 0x0a5ull << 20, + 0x0a6ull << 20, + 0x0a7ull << 20, + 0x0a8ull << 20, + 0x0a9ull << 20, + + 0x0b0ull << 20, + 0x0b1ull << 20, + 0x0b2ull << 20, + 0x0b3ull << 20, + 0x0b4ull << 20, + 0x0b5ull << 20, + 0x0b6ull << 20, + 0x0b7ull << 20, + 0x0b8ull << 20, + 0x0b9ull << 20, + + 0x0c0ull << 20, + 0x0c1ull << 20, + 0x0c2ull << 20, + 0x0c3ull << 20, + 0x0c4ull << 20, + 0x0c5ull << 20, + 0x0c6ull << 20, + 0x0c7ull << 20, + 0x0c8ull << 20, + 0x0c9ull << 20, + + 0x0d0ull << 20, + 0x0d1ull << 20, + 0x0d2ull << 20, + 0x0d3ull << 20, + 0x0d4ull << 20, + 0x0d5ull << 20, + 0x0d6ull << 20, + 0x0d7ull << 20, + 0x0d8ull << 20, + 0x0d9ull << 20, + + 0x0e0ull << 20, + 0x0e1ull << 20, + 0x0e2ull << 20, + 0x0e3ull << 20, + 0x0e4ull << 20, + 0x0e5ull << 20, + 0x0e6ull << 20, + 0x0e7ull << 20, + 0x0e8ull << 20, + 0x0e9ull << 20, + + 0x0f0ull << 20, + 0x0f1ull << 20, + 0x0f2ull << 20, + 0x0f3ull << 20, + 0x0f4ull << 20, + 0x0f5ull << 20, + 0x0f6ull << 20, + 0x0f7ull << 20, + 0x0f8ull << 20, + 0x0f9ull << 20, + + 0x08aull << 20, + 0x08bull << 20, + 0x0aaull << 20, + 0x0abull << 20, + 0x0caull << 20, + 0x0cbull << 20, + 0x0eaull << 20, + 0x0ebull << 20, + 0x0ceull << 20, + 0x0cfull << 20, + + 0x09aull << 20, + 0x09bull << 20, + 0x0baull << 20, + 0x0bbull << 20, + 0x0daull << 20, + 0x0dbull << 20, + 0x0faull << 20, + 0x0fbull << 20, + 0x0deull << 20, + 0x0dfull << 20, + + 0x100ull << 20, + 0x101ull << 20, + 0x102ull << 20, + 0x103ull << 20, + 0x104ull << 20, + 0x105ull << 20, + 0x106ull << 20, + 0x107ull << 20, + 0x108ull << 20, + 0x109ull << 20, + + 0x110ull << 20, + 0x111ull << 20, + 0x112ull << 20, + 0x113ull << 20, + 0x114ull << 20, + 0x115ull << 20, + 0x116ull << 20, + 0x117ull << 20, + 0x118ull << 20, + 0x119ull << 20, + + 0x120ull << 20, + 0x121ull << 20, + 0x122ull << 20, + 0x123ull << 20, + 0x124ull << 20, + 0x125ull << 20, + 0x126ull << 20, + 0x127ull << 20, + 0x128ull << 20, + 0x129ull << 20, + + 0x130ull << 20, + 0x131ull << 20, + 0x132ull << 20, + 0x133ull << 20, + 0x134ull << 20, + 0x135ull << 20, + 0x136ull << 20, + 0x137ull << 20, + 0x138ull << 20, + 0x139ull << 20, + + 0x140ull << 20, + 0x141ull << 20, + 0x142ull << 20, + 0x143ull << 20, + 0x144ull << 20, + 0x145ull << 20, + 0x146ull << 20, + 0x147ull << 20, + 0x148ull << 20, + 0x149ull << 20, + + 0x150ull << 20, + 0x151ull << 20, + 0x152ull << 20, + 0x153ull << 20, + 0x154ull << 20, + 0x155ull << 20, + 0x156ull << 20, + 0x157ull << 20, + 0x158ull << 20, + 0x159ull << 20, + + 0x160ull << 20, + 0x161ull << 20, + 0x162ull << 20, + 0x163ull << 20, + 0x164ull << 20, + 0x165ull << 20, + 0x166ull << 20, + 0x167ull << 20, + 0x168ull << 20, + 0x169ull << 20, + + 0x170ull << 20, + 0x171ull << 20, + 0x172ull << 20, + 0x173ull << 20, + 0x174ull << 20, + 0x175ull << 20, + 0x176ull << 20, + 0x177ull << 20, + 0x178ull << 20, + 0x179ull << 20, + + 0x10aull << 20, + 0x10bull << 20, + 0x12aull << 20, + 0x12bull << 20, + 0x14aull << 20, + 0x14bull << 20, + 0x16aull << 20, + 0x16bull << 20, + 0x14eull << 20, + 0x14full << 20, + + 0x11aull << 20, + 0x11bull << 20, + 0x13aull << 20, + 0x13bull << 20, + 0x15aull << 20, + 0x15bull << 20, + 0x17aull << 20, + 0x17bull << 20, + 0x15eull << 20, + 0x15full << 20, + + 0x180ull << 20, + 0x181ull << 20, + 0x182ull << 20, + 0x183ull << 20, + 0x184ull << 20, + 0x185ull << 20, + 0x186ull << 20, + 0x187ull << 20, + 0x188ull << 20, + 0x189ull << 20, + + 0x190ull << 20, + 0x191ull << 20, + 0x192ull << 20, + 0x193ull << 20, + 0x194ull << 20, + 0x195ull << 20, + 0x196ull << 20, + 0x197ull << 20, + 0x198ull << 20, + 0x199ull << 20, + + 0x1a0ull << 20, + 0x1a1ull << 20, + 0x1a2ull << 20, + 0x1a3ull << 20, + 0x1a4ull << 20, + 0x1a5ull << 20, + 0x1a6ull << 20, + 0x1a7ull << 20, + 0x1a8ull << 20, + 0x1a9ull << 20, + + 0x1b0ull << 20, + 0x1b1ull << 20, + 0x1b2ull << 20, + 0x1b3ull << 20, + 0x1b4ull << 20, + 0x1b5ull << 20, + 0x1b6ull << 20, + 0x1b7ull << 20, + 0x1b8ull << 20, + 0x1b9ull << 20, + + 0x1c0ull << 20, + 0x1c1ull << 20, + 0x1c2ull << 20, + 0x1c3ull << 20, + 0x1c4ull << 20, + 0x1c5ull << 20, + 0x1c6ull << 20, + 0x1c7ull << 20, + 0x1c8ull << 20, + 0x1c9ull << 20, + + 0x1d0ull << 20, + 0x1d1ull << 20, + 0x1d2ull << 20, + 0x1d3ull << 20, + 0x1d4ull << 20, + 0x1d5ull << 20, + 0x1d6ull << 20, + 0x1d7ull << 20, + 0x1d8ull << 20, + 0x1d9ull << 20, + + 0x1e0ull << 20, + 0x1e1ull << 20, + 0x1e2ull << 20, + 0x1e3ull << 20, + 0x1e4ull << 20, + 0x1e5ull << 20, + 0x1e6ull << 20, + 0x1e7ull << 20, + 0x1e8ull << 20, + 0x1e9ull << 20, + + 0x1f0ull << 20, + 0x1f1ull << 20, + 0x1f2ull << 20, + 0x1f3ull << 20, + 0x1f4ull << 20, + 0x1f5ull << 20, + 0x1f6ull << 20, + 0x1f7ull << 20, + 0x1f8ull << 20, + 0x1f9ull << 20, + + 0x18aull << 20, + 0x18bull << 20, + 0x1aaull << 20, + 0x1abull << 20, + 0x1caull << 20, + 0x1cbull << 20, + 0x1eaull << 20, + 0x1ebull << 20, + 0x1ceull << 20, + 0x1cfull << 20, + + 0x19aull << 20, + 0x19bull << 20, + 0x1baull << 20, + 0x1bbull << 20, + 0x1daull << 20, + 0x1dbull << 20, + 0x1faull << 20, + 0x1fbull << 20, + 0x1deull << 20, + 0x1dfull << 20, + + 0x200ull << 20, + 0x201ull << 20, + 0x202ull << 20, + 0x203ull << 20, + 0x204ull << 20, + 0x205ull << 20, + 0x206ull << 20, + 0x207ull << 20, + 0x208ull << 20, + 0x209ull << 20, + + 0x210ull << 20, + 0x211ull << 20, + 0x212ull << 20, + 0x213ull << 20, + 0x214ull << 20, + 0x215ull << 20, + 0x216ull << 20, + 0x217ull << 20, + 0x218ull << 20, + 0x219ull << 20, + + 0x220ull << 20, + 0x221ull << 20, + 0x222ull << 20, + 0x223ull << 20, + 0x224ull << 20, + 0x225ull << 20, + 0x226ull << 20, + 0x227ull << 20, + 0x228ull << 20, + 0x229ull << 20, + + 0x230ull << 20, + 0x231ull << 20, + 0x232ull << 20, + 0x233ull << 20, + 0x234ull << 20, + 0x235ull << 20, + 0x236ull << 20, + 0x237ull << 20, + 0x238ull << 20, + 0x239ull << 20, + + 0x240ull << 20, + 0x241ull << 20, + 0x242ull << 20, + 0x243ull << 20, + 0x244ull << 20, + 0x245ull << 20, + 0x246ull << 20, + 0x247ull << 20, + 0x248ull << 20, + 0x249ull << 20, + + 0x250ull << 20, + 0x251ull << 20, + 0x252ull << 20, + 0x253ull << 20, + 0x254ull << 20, + 0x255ull << 20, + 0x256ull << 20, + 0x257ull << 20, + 0x258ull << 20, + 0x259ull << 20, + + 0x260ull << 20, + 0x261ull << 20, + 0x262ull << 20, + 0x263ull << 20, + 0x264ull << 20, + 0x265ull << 20, + 0x266ull << 20, + 0x267ull << 20, + 0x268ull << 20, + 0x269ull << 20, + + 0x270ull << 20, + 0x271ull << 20, + 0x272ull << 20, + 0x273ull << 20, + 0x274ull << 20, + 0x275ull << 20, + 0x276ull << 20, + 0x277ull << 20, + 0x278ull << 20, + 0x279ull << 20, + + 0x20aull << 20, + 0x20bull << 20, + 0x22aull << 20, + 0x22bull << 20, + 0x24aull << 20, + 0x24bull << 20, + 0x26aull << 20, + 0x26bull << 20, + 0x24eull << 20, + 0x24full << 20, + + 0x21aull << 20, + 0x21bull << 20, + 0x23aull << 20, + 0x23bull << 20, + 0x25aull << 20, + 0x25bull << 20, + 0x27aull << 20, + 0x27bull << 20, + 0x25eull << 20, + 0x25full << 20, + + 0x280ull << 20, + 0x281ull << 20, + 0x282ull << 20, + 0x283ull << 20, + 0x284ull << 20, + 0x285ull << 20, + 0x286ull << 20, + 0x287ull << 20, + 0x288ull << 20, + 0x289ull << 20, + + 0x290ull << 20, + 0x291ull << 20, + 0x292ull << 20, + 0x293ull << 20, + 0x294ull << 20, + 0x295ull << 20, + 0x296ull << 20, + 0x297ull << 20, + 0x298ull << 20, + 0x299ull << 20, + + 0x2a0ull << 20, + 0x2a1ull << 20, + 0x2a2ull << 20, + 0x2a3ull << 20, + 0x2a4ull << 20, + 0x2a5ull << 20, + 0x2a6ull << 20, + 0x2a7ull << 20, + 0x2a8ull << 20, + 0x2a9ull << 20, + + 0x2b0ull << 20, + 0x2b1ull << 20, + 0x2b2ull << 20, + 0x2b3ull << 20, + 0x2b4ull << 20, + 0x2b5ull << 20, + 0x2b6ull << 20, + 0x2b7ull << 20, + 0x2b8ull << 20, + 0x2b9ull << 20, + + 0x2c0ull << 20, + 0x2c1ull << 20, + 0x2c2ull << 20, + 0x2c3ull << 20, + 0x2c4ull << 20, + 0x2c5ull << 20, + 0x2c6ull << 20, + 0x2c7ull << 20, + 0x2c8ull << 20, + 0x2c9ull << 20, + + 0x2d0ull << 20, + 0x2d1ull << 20, + 0x2d2ull << 20, + 0x2d3ull << 20, + 0x2d4ull << 20, + 0x2d5ull << 20, + 0x2d6ull << 20, + 0x2d7ull << 20, + 0x2d8ull << 20, + 0x2d9ull << 20, + + 0x2e0ull << 20, + 0x2e1ull << 20, + 0x2e2ull << 20, + 0x2e3ull << 20, + 0x2e4ull << 20, + 0x2e5ull << 20, + 0x2e6ull << 20, + 0x2e7ull << 20, + 0x2e8ull << 20, + 0x2e9ull << 20, + + 0x2f0ull << 20, + 0x2f1ull << 20, + 0x2f2ull << 20, + 0x2f3ull << 20, + 0x2f4ull << 20, + 0x2f5ull << 20, + 0x2f6ull << 20, + 0x2f7ull << 20, + 0x2f8ull << 20, + 0x2f9ull << 20, + + 0x28aull << 20, + 0x28bull << 20, + 0x2aaull << 20, + 0x2abull << 20, + 0x2caull << 20, + 0x2cbull << 20, + 0x2eaull << 20, + 0x2ebull << 20, + 0x2ceull << 20, + 0x2cfull << 20, + + 0x29aull << 20, + 0x29bull << 20, + 0x2baull << 20, + 0x2bbull << 20, + 0x2daull << 20, + 0x2dbull << 20, + 0x2faull << 20, + 0x2fbull << 20, + 0x2deull << 20, + 0x2dfull << 20, + + 0x300ull << 20, + 0x301ull << 20, + 0x302ull << 20, + 0x303ull << 20, + 0x304ull << 20, + 0x305ull << 20, + 0x306ull << 20, + 0x307ull << 20, + 0x308ull << 20, + 0x309ull << 20, + + 0x310ull << 20, + 0x311ull << 20, + 0x312ull << 20, + 0x313ull << 20, + 0x314ull << 20, + 0x315ull << 20, + 0x316ull << 20, + 0x317ull << 20, + 0x318ull << 20, + 0x319ull << 20, + + 0x320ull << 20, + 0x321ull << 20, + 0x322ull << 20, + 0x323ull << 20, + 0x324ull << 20, + 0x325ull << 20, + 0x326ull << 20, + 0x327ull << 20, + 0x328ull << 20, + 0x329ull << 20, + + 0x330ull << 20, + 0x331ull << 20, + 0x332ull << 20, + 0x333ull << 20, + 0x334ull << 20, + 0x335ull << 20, + 0x336ull << 20, + 0x337ull << 20, + 0x338ull << 20, + 0x339ull << 20, + + 0x340ull << 20, + 0x341ull << 20, + 0x342ull << 20, + 0x343ull << 20, + 0x344ull << 20, + 0x345ull << 20, + 0x346ull << 20, + 0x347ull << 20, + 0x348ull << 20, + 0x349ull << 20, + + 0x350ull << 20, + 0x351ull << 20, + 0x352ull << 20, + 0x353ull << 20, + 0x354ull << 20, + 0x355ull << 20, + 0x356ull << 20, + 0x357ull << 20, + 0x358ull << 20, + 0x359ull << 20, + + 0x360ull << 20, + 0x361ull << 20, + 0x362ull << 20, + 0x363ull << 20, + 0x364ull << 20, + 0x365ull << 20, + 0x366ull << 20, + 0x367ull << 20, + 0x368ull << 20, + 0x369ull << 20, + + 0x370ull << 20, + 0x371ull << 20, + 0x372ull << 20, + 0x373ull << 20, + 0x374ull << 20, + 0x375ull << 20, + 0x376ull << 20, + 0x377ull << 20, + 0x378ull << 20, + 0x379ull << 20, + + 0x30aull << 20, + 0x30bull << 20, + 0x32aull << 20, + 0x32bull << 20, + 0x34aull << 20, + 0x34bull << 20, + 0x36aull << 20, + 0x36bull << 20, + 0x34eull << 20, + 0x34full << 20, + + 0x31aull << 20, + 0x31bull << 20, + 0x33aull << 20, + 0x33bull << 20, + 0x35aull << 20, + 0x35bull << 20, + 0x37aull << 20, + 0x37bull << 20, + 0x35eull << 20, + 0x35full << 20, + + 0x380ull << 20, + 0x381ull << 20, + 0x382ull << 20, + 0x383ull << 20, + 0x384ull << 20, + 0x385ull << 20, + 0x386ull << 20, + 0x387ull << 20, + 0x388ull << 20, + 0x389ull << 20, + + 0x390ull << 20, + 0x391ull << 20, + 0x392ull << 20, + 0x393ull << 20, + 0x394ull << 20, + 0x395ull << 20, + 0x396ull << 20, + 0x397ull << 20, + 0x398ull << 20, + 0x399ull << 20, + + 0x3a0ull << 20, + 0x3a1ull << 20, + 0x3a2ull << 20, + 0x3a3ull << 20, + 0x3a4ull << 20, + 0x3a5ull << 20, + 0x3a6ull << 20, + 0x3a7ull << 20, + 0x3a8ull << 20, + 0x3a9ull << 20, + + 0x3b0ull << 20, + 0x3b1ull << 20, + 0x3b2ull << 20, + 0x3b3ull << 20, + 0x3b4ull << 20, + 0x3b5ull << 20, + 0x3b6ull << 20, + 0x3b7ull << 20, + 0x3b8ull << 20, + 0x3b9ull << 20, + + 0x3c0ull << 20, + 0x3c1ull << 20, + 0x3c2ull << 20, + 0x3c3ull << 20, + 0x3c4ull << 20, + 0x3c5ull << 20, + 0x3c6ull << 20, + 0x3c7ull << 20, + 0x3c8ull << 20, + 0x3c9ull << 20, + + 0x3d0ull << 20, + 0x3d1ull << 20, + 0x3d2ull << 20, + 0x3d3ull << 20, + 0x3d4ull << 20, + 0x3d5ull << 20, + 0x3d6ull << 20, + 0x3d7ull << 20, + 0x3d8ull << 20, + 0x3d9ull << 20, + + 0x3e0ull << 20, + 0x3e1ull << 20, + 0x3e2ull << 20, + 0x3e3ull << 20, + 0x3e4ull << 20, + 0x3e5ull << 20, + 0x3e6ull << 20, + 0x3e7ull << 20, + 0x3e8ull << 20, + 0x3e9ull << 20, + + 0x3f0ull << 20, + 0x3f1ull << 20, + 0x3f2ull << 20, + 0x3f3ull << 20, + 0x3f4ull << 20, + 0x3f5ull << 20, + 0x3f6ull << 20, + 0x3f7ull << 20, + 0x3f8ull << 20, + 0x3f9ull << 20, + + 0x38aull << 20, + 0x38bull << 20, + 0x3aaull << 20, + 0x3abull << 20, + 0x3caull << 20, + 0x3cbull << 20, + 0x3eaull << 20, + 0x3ebull << 20, + 0x3ceull << 20, + 0x3cfull << 20, + + 0x39aull << 20, + 0x39bull << 20, + 0x3baull << 20, + 0x3bbull << 20, + 0x3daull << 20, + 0x3dbull << 20, + 0x3faull << 20, + 0x3fbull << 20, + 0x3deull << 20, + 0x3dfull << 20, + + 0x00cull << 20, + 0x00dull << 20, + 0x10cull << 20, + 0x10dull << 20, + 0x20cull << 20, + 0x20dull << 20, + 0x30cull << 20, + 0x30dull << 20, + 0x02eull << 20, + 0x02full << 20, + + 0x01cull << 20, + 0x01dull << 20, + 0x11cull << 20, + 0x11dull << 20, + 0x21cull << 20, + 0x21dull << 20, + 0x31cull << 20, + 0x31dull << 20, + 0x03eull << 20, + 0x03full << 20, + + 0x02cull << 20, + 0x02dull << 20, + 0x12cull << 20, + 0x12dull << 20, + 0x22cull << 20, + 0x22dull << 20, + 0x32cull << 20, + 0x32dull << 20, + 0x12eull << 20, + 0x12full << 20, + + 0x03cull << 20, + 0x03dull << 20, + 0x13cull << 20, + 0x13dull << 20, + 0x23cull << 20, + 0x23dull << 20, + 0x33cull << 20, + 0x33dull << 20, + 0x13eull << 20, + 0x13full << 20, + + 0x04cull << 20, + 0x04dull << 20, + 0x14cull << 20, + 0x14dull << 20, + 0x24cull << 20, + 0x24dull << 20, + 0x34cull << 20, + 0x34dull << 20, + 0x22eull << 20, + 0x22full << 20, + + 0x05cull << 20, + 0x05dull << 20, + 0x15cull << 20, + 0x15dull << 20, + 0x25cull << 20, + 0x25dull << 20, + 0x35cull << 20, + 0x35dull << 20, + 0x23eull << 20, + 0x23full << 20, + + 0x06cull << 20, + 0x06dull << 20, + 0x16cull << 20, + 0x16dull << 20, + 0x26cull << 20, + 0x26dull << 20, + 0x36cull << 20, + 0x36dull << 20, + 0x32eull << 20, + 0x32full << 20, + + 0x07cull << 20, + 0x07dull << 20, + 0x17cull << 20, + 0x17dull << 20, + 0x27cull << 20, + 0x27dull << 20, + 0x37cull << 20, + 0x37dull << 20, + 0x33eull << 20, + 0x33full << 20, + + 0x00eull << 20, + 0x00full << 20, + 0x10eull << 20, + 0x10full << 20, + 0x20eull << 20, + 0x20full << 20, + 0x30eull << 20, + 0x30full << 20, + 0x06eull << 20, + 0x06full << 20, + + 0x01eull << 20, + 0x01full << 20, + 0x11eull << 20, + 0x11full << 20, + 0x21eull << 20, + 0x21full << 20, + 0x31eull << 20, + 0x31full << 20, + 0x07eull << 20, + 0x07full << 20, + + 0x08cull << 20, + 0x08dull << 20, + 0x18cull << 20, + 0x18dull << 20, + 0x28cull << 20, + 0x28dull << 20, + 0x38cull << 20, + 0x38dull << 20, + 0x0aeull << 20, + 0x0afull << 20, + + 0x09cull << 20, + 0x09dull << 20, + 0x19cull << 20, + 0x19dull << 20, + 0x29cull << 20, + 0x29dull << 20, + 0x39cull << 20, + 0x39dull << 20, + 0x0beull << 20, + 0x0bfull << 20, + + 0x0acull << 20, + 0x0adull << 20, + 0x1acull << 20, + 0x1adull << 20, + 0x2acull << 20, + 0x2adull << 20, + 0x3acull << 20, + 0x3adull << 20, + 0x1aeull << 20, + 0x1afull << 20, + + 0x0bcull << 20, + 0x0bdull << 20, + 0x1bcull << 20, + 0x1bdull << 20, + 0x2bcull << 20, + 0x2bdull << 20, + 0x3bcull << 20, + 0x3bdull << 20, + 0x1beull << 20, + 0x1bfull << 20, + + 0x0ccull << 20, + 0x0cdull << 20, + 0x1ccull << 20, + 0x1cdull << 20, + 0x2ccull << 20, + 0x2cdull << 20, + 0x3ccull << 20, + 0x3cdull << 20, + 0x2aeull << 20, + 0x2afull << 20, + + 0x0dcull << 20, + 0x0ddull << 20, + 0x1dcull << 20, + 0x1ddull << 20, + 0x2dcull << 20, + 0x2ddull << 20, + 0x3dcull << 20, + 0x3ddull << 20, + 0x2beull << 20, + 0x2bfull << 20, + + 0x0ecull << 20, + 0x0edull << 20, + 0x1ecull << 20, + 0x1edull << 20, + 0x2ecull << 20, + 0x2edull << 20, + 0x3ecull << 20, + 0x3edull << 20, + 0x3aeull << 20, + 0x3afull << 20, + + 0x0fcull << 20, + 0x0fdull << 20, + 0x1fcull << 20, + 0x1fdull << 20, + 0x2fcull << 20, + 0x2fdull << 20, + 0x3fcull << 20, + 0x3fdull << 20, + 0x3beull << 20, + 0x3bfull << 20, + + 0x08eull << 20, + 0x08full << 20, + 0x18eull << 20, + 0x18full << 20, + 0x28eull << 20, + 0x28full << 20, + 0x38eull << 20, + 0x38full << 20, + 0x0eeull << 20, + 0x0efull << 20, + + 0x09eull << 20, + 0x09full << 20, + 0x19eull << 20, + 0x19full << 20, + 0x29eull << 20, + 0x29full << 20, + 0x39eull << 20, + 0x39full << 20, + 0x0feull << 20, + 0x0ffull << 20 +}; + +static const UINT64 b2d4[] = { + 0x000ull << 30, + 0x001ull << 30, + 0x002ull << 30, + 0x003ull << 30, + 0x004ull << 30, + 0x005ull << 30, + 0x006ull << 30, + 0x007ull << 30, + 0x008ull << 30, + 0x009ull << 30, + + 0x010ull << 30, + 0x011ull << 30, + 0x012ull << 30, + 0x013ull << 30, + 0x014ull << 30, + 0x015ull << 30, + 0x016ull << 30, + 0x017ull << 30, + 0x018ull << 30, + 0x019ull << 30, + + 0x020ull << 30, + 0x021ull << 30, + 0x022ull << 30, + 0x023ull << 30, + 0x024ull << 30, + 0x025ull << 30, + 0x026ull << 30, + 0x027ull << 30, + 0x028ull << 30, + 0x029ull << 30, + + 0x030ull << 30, + 0x031ull << 30, + 0x032ull << 30, + 0x033ull << 30, + 0x034ull << 30, + 0x035ull << 30, + 0x036ull << 30, + 0x037ull << 30, + 0x038ull << 30, + 0x039ull << 30, + + 0x040ull << 30, + 0x041ull << 30, + 0x042ull << 30, + 0x043ull << 30, + 0x044ull << 30, + 0x045ull << 30, + 0x046ull << 30, + 0x047ull << 30, + 0x048ull << 30, + 0x049ull << 30, + + 0x050ull << 30, + 0x051ull << 30, + 0x052ull << 30, + 0x053ull << 30, + 0x054ull << 30, + 0x055ull << 30, + 0x056ull << 30, + 0x057ull << 30, + 0x058ull << 30, + 0x059ull << 30, + + 0x060ull << 30, + 0x061ull << 30, + 0x062ull << 30, + 0x063ull << 30, + 0x064ull << 30, + 0x065ull << 30, + 0x066ull << 30, + 0x067ull << 30, + 0x068ull << 30, + 0x069ull << 30, + + 0x070ull << 30, + 0x071ull << 30, + 0x072ull << 30, + 0x073ull << 30, + 0x074ull << 30, + 0x075ull << 30, + 0x076ull << 30, + 0x077ull << 30, + 0x078ull << 30, + 0x079ull << 30, + + 0x00aull << 30, + 0x00bull << 30, + 0x02aull << 30, + 0x02bull << 30, + 0x04aull << 30, + 0x04bull << 30, + 0x06aull << 30, + 0x06bull << 30, + 0x04eull << 30, + 0x04full << 30, + + 0x01aull << 30, + 0x01bull << 30, + 0x03aull << 30, + 0x03bull << 30, + 0x05aull << 30, + 0x05bull << 30, + 0x07aull << 30, + 0x07bull << 30, + 0x05eull << 30, + 0x05full << 30, + + 0x080ull << 30, + 0x081ull << 30, + 0x082ull << 30, + 0x083ull << 30, + 0x084ull << 30, + 0x085ull << 30, + 0x086ull << 30, + 0x087ull << 30, + 0x088ull << 30, + 0x089ull << 30, + + 0x090ull << 30, + 0x091ull << 30, + 0x092ull << 30, + 0x093ull << 30, + 0x094ull << 30, + 0x095ull << 30, + 0x096ull << 30, + 0x097ull << 30, + 0x098ull << 30, + 0x099ull << 30, + + 0x0a0ull << 30, + 0x0a1ull << 30, + 0x0a2ull << 30, + 0x0a3ull << 30, + 0x0a4ull << 30, + 0x0a5ull << 30, + 0x0a6ull << 30, + 0x0a7ull << 30, + 0x0a8ull << 30, + 0x0a9ull << 30, + + 0x0b0ull << 30, + 0x0b1ull << 30, + 0x0b2ull << 30, + 0x0b3ull << 30, + 0x0b4ull << 30, + 0x0b5ull << 30, + 0x0b6ull << 30, + 0x0b7ull << 30, + 0x0b8ull << 30, + 0x0b9ull << 30, + + 0x0c0ull << 30, + 0x0c1ull << 30, + 0x0c2ull << 30, + 0x0c3ull << 30, + 0x0c4ull << 30, + 0x0c5ull << 30, + 0x0c6ull << 30, + 0x0c7ull << 30, + 0x0c8ull << 30, + 0x0c9ull << 30, + + 0x0d0ull << 30, + 0x0d1ull << 30, + 0x0d2ull << 30, + 0x0d3ull << 30, + 0x0d4ull << 30, + 0x0d5ull << 30, + 0x0d6ull << 30, + 0x0d7ull << 30, + 0x0d8ull << 30, + 0x0d9ull << 30, + + 0x0e0ull << 30, + 0x0e1ull << 30, + 0x0e2ull << 30, + 0x0e3ull << 30, + 0x0e4ull << 30, + 0x0e5ull << 30, + 0x0e6ull << 30, + 0x0e7ull << 30, + 0x0e8ull << 30, + 0x0e9ull << 30, + + 0x0f0ull << 30, + 0x0f1ull << 30, + 0x0f2ull << 30, + 0x0f3ull << 30, + 0x0f4ull << 30, + 0x0f5ull << 30, + 0x0f6ull << 30, + 0x0f7ull << 30, + 0x0f8ull << 30, + 0x0f9ull << 30, + + 0x08aull << 30, + 0x08bull << 30, + 0x0aaull << 30, + 0x0abull << 30, + 0x0caull << 30, + 0x0cbull << 30, + 0x0eaull << 30, + 0x0ebull << 30, + 0x0ceull << 30, + 0x0cfull << 30, + + 0x09aull << 30, + 0x09bull << 30, + 0x0baull << 30, + 0x0bbull << 30, + 0x0daull << 30, + 0x0dbull << 30, + 0x0faull << 30, + 0x0fbull << 30, + 0x0deull << 30, + 0x0dfull << 30, + + 0x100ull << 30, + 0x101ull << 30, + 0x102ull << 30, + 0x103ull << 30, + 0x104ull << 30, + 0x105ull << 30, + 0x106ull << 30, + 0x107ull << 30, + 0x108ull << 30, + 0x109ull << 30, + + 0x110ull << 30, + 0x111ull << 30, + 0x112ull << 30, + 0x113ull << 30, + 0x114ull << 30, + 0x115ull << 30, + 0x116ull << 30, + 0x117ull << 30, + 0x118ull << 30, + 0x119ull << 30, + + 0x120ull << 30, + 0x121ull << 30, + 0x122ull << 30, + 0x123ull << 30, + 0x124ull << 30, + 0x125ull << 30, + 0x126ull << 30, + 0x127ull << 30, + 0x128ull << 30, + 0x129ull << 30, + + 0x130ull << 30, + 0x131ull << 30, + 0x132ull << 30, + 0x133ull << 30, + 0x134ull << 30, + 0x135ull << 30, + 0x136ull << 30, + 0x137ull << 30, + 0x138ull << 30, + 0x139ull << 30, + + 0x140ull << 30, + 0x141ull << 30, + 0x142ull << 30, + 0x143ull << 30, + 0x144ull << 30, + 0x145ull << 30, + 0x146ull << 30, + 0x147ull << 30, + 0x148ull << 30, + 0x149ull << 30, + + 0x150ull << 30, + 0x151ull << 30, + 0x152ull << 30, + 0x153ull << 30, + 0x154ull << 30, + 0x155ull << 30, + 0x156ull << 30, + 0x157ull << 30, + 0x158ull << 30, + 0x159ull << 30, + + 0x160ull << 30, + 0x161ull << 30, + 0x162ull << 30, + 0x163ull << 30, + 0x164ull << 30, + 0x165ull << 30, + 0x166ull << 30, + 0x167ull << 30, + 0x168ull << 30, + 0x169ull << 30, + + 0x170ull << 30, + 0x171ull << 30, + 0x172ull << 30, + 0x173ull << 30, + 0x174ull << 30, + 0x175ull << 30, + 0x176ull << 30, + 0x177ull << 30, + 0x178ull << 30, + 0x179ull << 30, + + 0x10aull << 30, + 0x10bull << 30, + 0x12aull << 30, + 0x12bull << 30, + 0x14aull << 30, + 0x14bull << 30, + 0x16aull << 30, + 0x16bull << 30, + 0x14eull << 30, + 0x14full << 30, + + 0x11aull << 30, + 0x11bull << 30, + 0x13aull << 30, + 0x13bull << 30, + 0x15aull << 30, + 0x15bull << 30, + 0x17aull << 30, + 0x17bull << 30, + 0x15eull << 30, + 0x15full << 30, + + 0x180ull << 30, + 0x181ull << 30, + 0x182ull << 30, + 0x183ull << 30, + 0x184ull << 30, + 0x185ull << 30, + 0x186ull << 30, + 0x187ull << 30, + 0x188ull << 30, + 0x189ull << 30, + + 0x190ull << 30, + 0x191ull << 30, + 0x192ull << 30, + 0x193ull << 30, + 0x194ull << 30, + 0x195ull << 30, + 0x196ull << 30, + 0x197ull << 30, + 0x198ull << 30, + 0x199ull << 30, + + 0x1a0ull << 30, + 0x1a1ull << 30, + 0x1a2ull << 30, + 0x1a3ull << 30, + 0x1a4ull << 30, + 0x1a5ull << 30, + 0x1a6ull << 30, + 0x1a7ull << 30, + 0x1a8ull << 30, + 0x1a9ull << 30, + + 0x1b0ull << 30, + 0x1b1ull << 30, + 0x1b2ull << 30, + 0x1b3ull << 30, + 0x1b4ull << 30, + 0x1b5ull << 30, + 0x1b6ull << 30, + 0x1b7ull << 30, + 0x1b8ull << 30, + 0x1b9ull << 30, + + 0x1c0ull << 30, + 0x1c1ull << 30, + 0x1c2ull << 30, + 0x1c3ull << 30, + 0x1c4ull << 30, + 0x1c5ull << 30, + 0x1c6ull << 30, + 0x1c7ull << 30, + 0x1c8ull << 30, + 0x1c9ull << 30, + + 0x1d0ull << 30, + 0x1d1ull << 30, + 0x1d2ull << 30, + 0x1d3ull << 30, + 0x1d4ull << 30, + 0x1d5ull << 30, + 0x1d6ull << 30, + 0x1d7ull << 30, + 0x1d8ull << 30, + 0x1d9ull << 30, + + 0x1e0ull << 30, + 0x1e1ull << 30, + 0x1e2ull << 30, + 0x1e3ull << 30, + 0x1e4ull << 30, + 0x1e5ull << 30, + 0x1e6ull << 30, + 0x1e7ull << 30, + 0x1e8ull << 30, + 0x1e9ull << 30, + + 0x1f0ull << 30, + 0x1f1ull << 30, + 0x1f2ull << 30, + 0x1f3ull << 30, + 0x1f4ull << 30, + 0x1f5ull << 30, + 0x1f6ull << 30, + 0x1f7ull << 30, + 0x1f8ull << 30, + 0x1f9ull << 30, + + 0x18aull << 30, + 0x18bull << 30, + 0x1aaull << 30, + 0x1abull << 30, + 0x1caull << 30, + 0x1cbull << 30, + 0x1eaull << 30, + 0x1ebull << 30, + 0x1ceull << 30, + 0x1cfull << 30, + + 0x19aull << 30, + 0x19bull << 30, + 0x1baull << 30, + 0x1bbull << 30, + 0x1daull << 30, + 0x1dbull << 30, + 0x1faull << 30, + 0x1fbull << 30, + 0x1deull << 30, + 0x1dfull << 30, + + 0x200ull << 30, + 0x201ull << 30, + 0x202ull << 30, + 0x203ull << 30, + 0x204ull << 30, + 0x205ull << 30, + 0x206ull << 30, + 0x207ull << 30, + 0x208ull << 30, + 0x209ull << 30, + + 0x210ull << 30, + 0x211ull << 30, + 0x212ull << 30, + 0x213ull << 30, + 0x214ull << 30, + 0x215ull << 30, + 0x216ull << 30, + 0x217ull << 30, + 0x218ull << 30, + 0x219ull << 30, + + 0x220ull << 30, + 0x221ull << 30, + 0x222ull << 30, + 0x223ull << 30, + 0x224ull << 30, + 0x225ull << 30, + 0x226ull << 30, + 0x227ull << 30, + 0x228ull << 30, + 0x229ull << 30, + + 0x230ull << 30, + 0x231ull << 30, + 0x232ull << 30, + 0x233ull << 30, + 0x234ull << 30, + 0x235ull << 30, + 0x236ull << 30, + 0x237ull << 30, + 0x238ull << 30, + 0x239ull << 30, + + 0x240ull << 30, + 0x241ull << 30, + 0x242ull << 30, + 0x243ull << 30, + 0x244ull << 30, + 0x245ull << 30, + 0x246ull << 30, + 0x247ull << 30, + 0x248ull << 30, + 0x249ull << 30, + + 0x250ull << 30, + 0x251ull << 30, + 0x252ull << 30, + 0x253ull << 30, + 0x254ull << 30, + 0x255ull << 30, + 0x256ull << 30, + 0x257ull << 30, + 0x258ull << 30, + 0x259ull << 30, + + 0x260ull << 30, + 0x261ull << 30, + 0x262ull << 30, + 0x263ull << 30, + 0x264ull << 30, + 0x265ull << 30, + 0x266ull << 30, + 0x267ull << 30, + 0x268ull << 30, + 0x269ull << 30, + + 0x270ull << 30, + 0x271ull << 30, + 0x272ull << 30, + 0x273ull << 30, + 0x274ull << 30, + 0x275ull << 30, + 0x276ull << 30, + 0x277ull << 30, + 0x278ull << 30, + 0x279ull << 30, + + 0x20aull << 30, + 0x20bull << 30, + 0x22aull << 30, + 0x22bull << 30, + 0x24aull << 30, + 0x24bull << 30, + 0x26aull << 30, + 0x26bull << 30, + 0x24eull << 30, + 0x24full << 30, + + 0x21aull << 30, + 0x21bull << 30, + 0x23aull << 30, + 0x23bull << 30, + 0x25aull << 30, + 0x25bull << 30, + 0x27aull << 30, + 0x27bull << 30, + 0x25eull << 30, + 0x25full << 30, + + 0x280ull << 30, + 0x281ull << 30, + 0x282ull << 30, + 0x283ull << 30, + 0x284ull << 30, + 0x285ull << 30, + 0x286ull << 30, + 0x287ull << 30, + 0x288ull << 30, + 0x289ull << 30, + + 0x290ull << 30, + 0x291ull << 30, + 0x292ull << 30, + 0x293ull << 30, + 0x294ull << 30, + 0x295ull << 30, + 0x296ull << 30, + 0x297ull << 30, + 0x298ull << 30, + 0x299ull << 30, + + 0x2a0ull << 30, + 0x2a1ull << 30, + 0x2a2ull << 30, + 0x2a3ull << 30, + 0x2a4ull << 30, + 0x2a5ull << 30, + 0x2a6ull << 30, + 0x2a7ull << 30, + 0x2a8ull << 30, + 0x2a9ull << 30, + + 0x2b0ull << 30, + 0x2b1ull << 30, + 0x2b2ull << 30, + 0x2b3ull << 30, + 0x2b4ull << 30, + 0x2b5ull << 30, + 0x2b6ull << 30, + 0x2b7ull << 30, + 0x2b8ull << 30, + 0x2b9ull << 30, + + 0x2c0ull << 30, + 0x2c1ull << 30, + 0x2c2ull << 30, + 0x2c3ull << 30, + 0x2c4ull << 30, + 0x2c5ull << 30, + 0x2c6ull << 30, + 0x2c7ull << 30, + 0x2c8ull << 30, + 0x2c9ull << 30, + + 0x2d0ull << 30, + 0x2d1ull << 30, + 0x2d2ull << 30, + 0x2d3ull << 30, + 0x2d4ull << 30, + 0x2d5ull << 30, + 0x2d6ull << 30, + 0x2d7ull << 30, + 0x2d8ull << 30, + 0x2d9ull << 30, + + 0x2e0ull << 30, + 0x2e1ull << 30, + 0x2e2ull << 30, + 0x2e3ull << 30, + 0x2e4ull << 30, + 0x2e5ull << 30, + 0x2e6ull << 30, + 0x2e7ull << 30, + 0x2e8ull << 30, + 0x2e9ull << 30, + + 0x2f0ull << 30, + 0x2f1ull << 30, + 0x2f2ull << 30, + 0x2f3ull << 30, + 0x2f4ull << 30, + 0x2f5ull << 30, + 0x2f6ull << 30, + 0x2f7ull << 30, + 0x2f8ull << 30, + 0x2f9ull << 30, + + 0x28aull << 30, + 0x28bull << 30, + 0x2aaull << 30, + 0x2abull << 30, + 0x2caull << 30, + 0x2cbull << 30, + 0x2eaull << 30, + 0x2ebull << 30, + 0x2ceull << 30, + 0x2cfull << 30, + + 0x29aull << 30, + 0x29bull << 30, + 0x2baull << 30, + 0x2bbull << 30, + 0x2daull << 30, + 0x2dbull << 30, + 0x2faull << 30, + 0x2fbull << 30, + 0x2deull << 30, + 0x2dfull << 30, + + 0x300ull << 30, + 0x301ull << 30, + 0x302ull << 30, + 0x303ull << 30, + 0x304ull << 30, + 0x305ull << 30, + 0x306ull << 30, + 0x307ull << 30, + 0x308ull << 30, + 0x309ull << 30, + + 0x310ull << 30, + 0x311ull << 30, + 0x312ull << 30, + 0x313ull << 30, + 0x314ull << 30, + 0x315ull << 30, + 0x316ull << 30, + 0x317ull << 30, + 0x318ull << 30, + 0x319ull << 30, + + 0x320ull << 30, + 0x321ull << 30, + 0x322ull << 30, + 0x323ull << 30, + 0x324ull << 30, + 0x325ull << 30, + 0x326ull << 30, + 0x327ull << 30, + 0x328ull << 30, + 0x329ull << 30, + + 0x330ull << 30, + 0x331ull << 30, + 0x332ull << 30, + 0x333ull << 30, + 0x334ull << 30, + 0x335ull << 30, + 0x336ull << 30, + 0x337ull << 30, + 0x338ull << 30, + 0x339ull << 30, + + 0x340ull << 30, + 0x341ull << 30, + 0x342ull << 30, + 0x343ull << 30, + 0x344ull << 30, + 0x345ull << 30, + 0x346ull << 30, + 0x347ull << 30, + 0x348ull << 30, + 0x349ull << 30, + + 0x350ull << 30, + 0x351ull << 30, + 0x352ull << 30, + 0x353ull << 30, + 0x354ull << 30, + 0x355ull << 30, + 0x356ull << 30, + 0x357ull << 30, + 0x358ull << 30, + 0x359ull << 30, + + 0x360ull << 30, + 0x361ull << 30, + 0x362ull << 30, + 0x363ull << 30, + 0x364ull << 30, + 0x365ull << 30, + 0x366ull << 30, + 0x367ull << 30, + 0x368ull << 30, + 0x369ull << 30, + + 0x370ull << 30, + 0x371ull << 30, + 0x372ull << 30, + 0x373ull << 30, + 0x374ull << 30, + 0x375ull << 30, + 0x376ull << 30, + 0x377ull << 30, + 0x378ull << 30, + 0x379ull << 30, + + 0x30aull << 30, + 0x30bull << 30, + 0x32aull << 30, + 0x32bull << 30, + 0x34aull << 30, + 0x34bull << 30, + 0x36aull << 30, + 0x36bull << 30, + 0x34eull << 30, + 0x34full << 30, + + 0x31aull << 30, + 0x31bull << 30, + 0x33aull << 30, + 0x33bull << 30, + 0x35aull << 30, + 0x35bull << 30, + 0x37aull << 30, + 0x37bull << 30, + 0x35eull << 30, + 0x35full << 30, + + 0x380ull << 30, + 0x381ull << 30, + 0x382ull << 30, + 0x383ull << 30, + 0x384ull << 30, + 0x385ull << 30, + 0x386ull << 30, + 0x387ull << 30, + 0x388ull << 30, + 0x389ull << 30, + + 0x390ull << 30, + 0x391ull << 30, + 0x392ull << 30, + 0x393ull << 30, + 0x394ull << 30, + 0x395ull << 30, + 0x396ull << 30, + 0x397ull << 30, + 0x398ull << 30, + 0x399ull << 30, + + 0x3a0ull << 30, + 0x3a1ull << 30, + 0x3a2ull << 30, + 0x3a3ull << 30, + 0x3a4ull << 30, + 0x3a5ull << 30, + 0x3a6ull << 30, + 0x3a7ull << 30, + 0x3a8ull << 30, + 0x3a9ull << 30, + + 0x3b0ull << 30, + 0x3b1ull << 30, + 0x3b2ull << 30, + 0x3b3ull << 30, + 0x3b4ull << 30, + 0x3b5ull << 30, + 0x3b6ull << 30, + 0x3b7ull << 30, + 0x3b8ull << 30, + 0x3b9ull << 30, + + 0x3c0ull << 30, + 0x3c1ull << 30, + 0x3c2ull << 30, + 0x3c3ull << 30, + 0x3c4ull << 30, + 0x3c5ull << 30, + 0x3c6ull << 30, + 0x3c7ull << 30, + 0x3c8ull << 30, + 0x3c9ull << 30, + + 0x3d0ull << 30, + 0x3d1ull << 30, + 0x3d2ull << 30, + 0x3d3ull << 30, + 0x3d4ull << 30, + 0x3d5ull << 30, + 0x3d6ull << 30, + 0x3d7ull << 30, + 0x3d8ull << 30, + 0x3d9ull << 30, + + 0x3e0ull << 30, + 0x3e1ull << 30, + 0x3e2ull << 30, + 0x3e3ull << 30, + 0x3e4ull << 30, + 0x3e5ull << 30, + 0x3e6ull << 30, + 0x3e7ull << 30, + 0x3e8ull << 30, + 0x3e9ull << 30, + + 0x3f0ull << 30, + 0x3f1ull << 30, + 0x3f2ull << 30, + 0x3f3ull << 30, + 0x3f4ull << 30, + 0x3f5ull << 30, + 0x3f6ull << 30, + 0x3f7ull << 30, + 0x3f8ull << 30, + 0x3f9ull << 30, + + 0x38aull << 30, + 0x38bull << 30, + 0x3aaull << 30, + 0x3abull << 30, + 0x3caull << 30, + 0x3cbull << 30, + 0x3eaull << 30, + 0x3ebull << 30, + 0x3ceull << 30, + 0x3cfull << 30, + + 0x39aull << 30, + 0x39bull << 30, + 0x3baull << 30, + 0x3bbull << 30, + 0x3daull << 30, + 0x3dbull << 30, + 0x3faull << 30, + 0x3fbull << 30, + 0x3deull << 30, + 0x3dfull << 30, + + 0x00cull << 30, + 0x00dull << 30, + 0x10cull << 30, + 0x10dull << 30, + 0x20cull << 30, + 0x20dull << 30, + 0x30cull << 30, + 0x30dull << 30, + 0x02eull << 30, + 0x02full << 30, + + 0x01cull << 30, + 0x01dull << 30, + 0x11cull << 30, + 0x11dull << 30, + 0x21cull << 30, + 0x21dull << 30, + 0x31cull << 30, + 0x31dull << 30, + 0x03eull << 30, + 0x03full << 30, + + 0x02cull << 30, + 0x02dull << 30, + 0x12cull << 30, + 0x12dull << 30, + 0x22cull << 30, + 0x22dull << 30, + 0x32cull << 30, + 0x32dull << 30, + 0x12eull << 30, + 0x12full << 30, + + 0x03cull << 30, + 0x03dull << 30, + 0x13cull << 30, + 0x13dull << 30, + 0x23cull << 30, + 0x23dull << 30, + 0x33cull << 30, + 0x33dull << 30, + 0x13eull << 30, + 0x13full << 30, + + 0x04cull << 30, + 0x04dull << 30, + 0x14cull << 30, + 0x14dull << 30, + 0x24cull << 30, + 0x24dull << 30, + 0x34cull << 30, + 0x34dull << 30, + 0x22eull << 30, + 0x22full << 30, + + 0x05cull << 30, + 0x05dull << 30, + 0x15cull << 30, + 0x15dull << 30, + 0x25cull << 30, + 0x25dull << 30, + 0x35cull << 30, + 0x35dull << 30, + 0x23eull << 30, + 0x23full << 30, + + 0x06cull << 30, + 0x06dull << 30, + 0x16cull << 30, + 0x16dull << 30, + 0x26cull << 30, + 0x26dull << 30, + 0x36cull << 30, + 0x36dull << 30, + 0x32eull << 30, + 0x32full << 30, + + 0x07cull << 30, + 0x07dull << 30, + 0x17cull << 30, + 0x17dull << 30, + 0x27cull << 30, + 0x27dull << 30, + 0x37cull << 30, + 0x37dull << 30, + 0x33eull << 30, + 0x33full << 30, + + 0x00eull << 30, + 0x00full << 30, + 0x10eull << 30, + 0x10full << 30, + 0x20eull << 30, + 0x20full << 30, + 0x30eull << 30, + 0x30full << 30, + 0x06eull << 30, + 0x06full << 30, + + 0x01eull << 30, + 0x01full << 30, + 0x11eull << 30, + 0x11full << 30, + 0x21eull << 30, + 0x21full << 30, + 0x31eull << 30, + 0x31full << 30, + 0x07eull << 30, + 0x07full << 30, + + 0x08cull << 30, + 0x08dull << 30, + 0x18cull << 30, + 0x18dull << 30, + 0x28cull << 30, + 0x28dull << 30, + 0x38cull << 30, + 0x38dull << 30, + 0x0aeull << 30, + 0x0afull << 30, + + 0x09cull << 30, + 0x09dull << 30, + 0x19cull << 30, + 0x19dull << 30, + 0x29cull << 30, + 0x29dull << 30, + 0x39cull << 30, + 0x39dull << 30, + 0x0beull << 30, + 0x0bfull << 30, + + 0x0acull << 30, + 0x0adull << 30, + 0x1acull << 30, + 0x1adull << 30, + 0x2acull << 30, + 0x2adull << 30, + 0x3acull << 30, + 0x3adull << 30, + 0x1aeull << 30, + 0x1afull << 30, + + 0x0bcull << 30, + 0x0bdull << 30, + 0x1bcull << 30, + 0x1bdull << 30, + 0x2bcull << 30, + 0x2bdull << 30, + 0x3bcull << 30, + 0x3bdull << 30, + 0x1beull << 30, + 0x1bfull << 30, + + 0x0ccull << 30, + 0x0cdull << 30, + 0x1ccull << 30, + 0x1cdull << 30, + 0x2ccull << 30, + 0x2cdull << 30, + 0x3ccull << 30, + 0x3cdull << 30, + 0x2aeull << 30, + 0x2afull << 30, + + 0x0dcull << 30, + 0x0ddull << 30, + 0x1dcull << 30, + 0x1ddull << 30, + 0x2dcull << 30, + 0x2ddull << 30, + 0x3dcull << 30, + 0x3ddull << 30, + 0x2beull << 30, + 0x2bfull << 30, + + 0x0ecull << 30, + 0x0edull << 30, + 0x1ecull << 30, + 0x1edull << 30, + 0x2ecull << 30, + 0x2edull << 30, + 0x3ecull << 30, + 0x3edull << 30, + 0x3aeull << 30, + 0x3afull << 30, + + 0x0fcull << 30, + 0x0fdull << 30, + 0x1fcull << 30, + 0x1fdull << 30, + 0x2fcull << 30, + 0x2fdull << 30, + 0x3fcull << 30, + 0x3fdull << 30, + 0x3beull << 30, + 0x3bfull << 30, + + 0x08eull << 30, + 0x08full << 30, + 0x18eull << 30, + 0x18full << 30, + 0x28eull << 30, + 0x28full << 30, + 0x38eull << 30, + 0x38full << 30, + 0x0eeull << 30, + 0x0efull << 30, + + 0x09eull << 30, + 0x09full << 30, + 0x19eull << 30, + 0x19full << 30, + 0x29eull << 30, + 0x29full << 30, + 0x39eull << 30, + 0x39full << 30, + 0x0feull << 30, + 0x0ffull << 30 +}; + +static const UINT64 b2d5[] = { + 0x000ull << 40, + 0x001ull << 40, + 0x002ull << 40, + 0x003ull << 40, + 0x004ull << 40, + 0x005ull << 40, + 0x006ull << 40, + 0x007ull << 40, + 0x008ull << 40, + 0x009ull << 40, + + 0x010ull << 40, + 0x011ull << 40, + 0x012ull << 40, + 0x013ull << 40, + 0x014ull << 40, + 0x015ull << 40, + 0x016ull << 40, + 0x017ull << 40, + 0x018ull << 40, + 0x019ull << 40, + + 0x020ull << 40, + 0x021ull << 40, + 0x022ull << 40, + 0x023ull << 40, + 0x024ull << 40, + 0x025ull << 40, + 0x026ull << 40, + 0x027ull << 40, + 0x028ull << 40, + 0x029ull << 40, + + 0x030ull << 40, + 0x031ull << 40, + 0x032ull << 40, + 0x033ull << 40, + 0x034ull << 40, + 0x035ull << 40, + 0x036ull << 40, + 0x037ull << 40, + 0x038ull << 40, + 0x039ull << 40, + + 0x040ull << 40, + 0x041ull << 40, + 0x042ull << 40, + 0x043ull << 40, + 0x044ull << 40, + 0x045ull << 40, + 0x046ull << 40, + 0x047ull << 40, + 0x048ull << 40, + 0x049ull << 40, + + 0x050ull << 40, + 0x051ull << 40, + 0x052ull << 40, + 0x053ull << 40, + 0x054ull << 40, + 0x055ull << 40, + 0x056ull << 40, + 0x057ull << 40, + 0x058ull << 40, + 0x059ull << 40, + + 0x060ull << 40, + 0x061ull << 40, + 0x062ull << 40, + 0x063ull << 40, + 0x064ull << 40, + 0x065ull << 40, + 0x066ull << 40, + 0x067ull << 40, + 0x068ull << 40, + 0x069ull << 40, + + 0x070ull << 40, + 0x071ull << 40, + 0x072ull << 40, + 0x073ull << 40, + 0x074ull << 40, + 0x075ull << 40, + 0x076ull << 40, + 0x077ull << 40, + 0x078ull << 40, + 0x079ull << 40, + + 0x00aull << 40, + 0x00bull << 40, + 0x02aull << 40, + 0x02bull << 40, + 0x04aull << 40, + 0x04bull << 40, + 0x06aull << 40, + 0x06bull << 40, + 0x04eull << 40, + 0x04full << 40, + + 0x01aull << 40, + 0x01bull << 40, + 0x03aull << 40, + 0x03bull << 40, + 0x05aull << 40, + 0x05bull << 40, + 0x07aull << 40, + 0x07bull << 40, + 0x05eull << 40, + 0x05full << 40, + + 0x080ull << 40, + 0x081ull << 40, + 0x082ull << 40, + 0x083ull << 40, + 0x084ull << 40, + 0x085ull << 40, + 0x086ull << 40, + 0x087ull << 40, + 0x088ull << 40, + 0x089ull << 40, + + 0x090ull << 40, + 0x091ull << 40, + 0x092ull << 40, + 0x093ull << 40, + 0x094ull << 40, + 0x095ull << 40, + 0x096ull << 40, + 0x097ull << 40, + 0x098ull << 40, + 0x099ull << 40, + + 0x0a0ull << 40, + 0x0a1ull << 40, + 0x0a2ull << 40, + 0x0a3ull << 40, + 0x0a4ull << 40, + 0x0a5ull << 40, + 0x0a6ull << 40, + 0x0a7ull << 40, + 0x0a8ull << 40, + 0x0a9ull << 40, + + 0x0b0ull << 40, + 0x0b1ull << 40, + 0x0b2ull << 40, + 0x0b3ull << 40, + 0x0b4ull << 40, + 0x0b5ull << 40, + 0x0b6ull << 40, + 0x0b7ull << 40, + 0x0b8ull << 40, + 0x0b9ull << 40, + + 0x0c0ull << 40, + 0x0c1ull << 40, + 0x0c2ull << 40, + 0x0c3ull << 40, + 0x0c4ull << 40, + 0x0c5ull << 40, + 0x0c6ull << 40, + 0x0c7ull << 40, + 0x0c8ull << 40, + 0x0c9ull << 40, + + 0x0d0ull << 40, + 0x0d1ull << 40, + 0x0d2ull << 40, + 0x0d3ull << 40, + 0x0d4ull << 40, + 0x0d5ull << 40, + 0x0d6ull << 40, + 0x0d7ull << 40, + 0x0d8ull << 40, + 0x0d9ull << 40, + + 0x0e0ull << 40, + 0x0e1ull << 40, + 0x0e2ull << 40, + 0x0e3ull << 40, + 0x0e4ull << 40, + 0x0e5ull << 40, + 0x0e6ull << 40, + 0x0e7ull << 40, + 0x0e8ull << 40, + 0x0e9ull << 40, + + 0x0f0ull << 40, + 0x0f1ull << 40, + 0x0f2ull << 40, + 0x0f3ull << 40, + 0x0f4ull << 40, + 0x0f5ull << 40, + 0x0f6ull << 40, + 0x0f7ull << 40, + 0x0f8ull << 40, + 0x0f9ull << 40, + + 0x08aull << 40, + 0x08bull << 40, + 0x0aaull << 40, + 0x0abull << 40, + 0x0caull << 40, + 0x0cbull << 40, + 0x0eaull << 40, + 0x0ebull << 40, + 0x0ceull << 40, + 0x0cfull << 40, + + 0x09aull << 40, + 0x09bull << 40, + 0x0baull << 40, + 0x0bbull << 40, + 0x0daull << 40, + 0x0dbull << 40, + 0x0faull << 40, + 0x0fbull << 40, + 0x0deull << 40, + 0x0dfull << 40, + + 0x100ull << 40, + 0x101ull << 40, + 0x102ull << 40, + 0x103ull << 40, + 0x104ull << 40, + 0x105ull << 40, + 0x106ull << 40, + 0x107ull << 40, + 0x108ull << 40, + 0x109ull << 40, + + 0x110ull << 40, + 0x111ull << 40, + 0x112ull << 40, + 0x113ull << 40, + 0x114ull << 40, + 0x115ull << 40, + 0x116ull << 40, + 0x117ull << 40, + 0x118ull << 40, + 0x119ull << 40, + + 0x120ull << 40, + 0x121ull << 40, + 0x122ull << 40, + 0x123ull << 40, + 0x124ull << 40, + 0x125ull << 40, + 0x126ull << 40, + 0x127ull << 40, + 0x128ull << 40, + 0x129ull << 40, + + 0x130ull << 40, + 0x131ull << 40, + 0x132ull << 40, + 0x133ull << 40, + 0x134ull << 40, + 0x135ull << 40, + 0x136ull << 40, + 0x137ull << 40, + 0x138ull << 40, + 0x139ull << 40, + + 0x140ull << 40, + 0x141ull << 40, + 0x142ull << 40, + 0x143ull << 40, + 0x144ull << 40, + 0x145ull << 40, + 0x146ull << 40, + 0x147ull << 40, + 0x148ull << 40, + 0x149ull << 40, + + 0x150ull << 40, + 0x151ull << 40, + 0x152ull << 40, + 0x153ull << 40, + 0x154ull << 40, + 0x155ull << 40, + 0x156ull << 40, + 0x157ull << 40, + 0x158ull << 40, + 0x159ull << 40, + + 0x160ull << 40, + 0x161ull << 40, + 0x162ull << 40, + 0x163ull << 40, + 0x164ull << 40, + 0x165ull << 40, + 0x166ull << 40, + 0x167ull << 40, + 0x168ull << 40, + 0x169ull << 40, + + 0x170ull << 40, + 0x171ull << 40, + 0x172ull << 40, + 0x173ull << 40, + 0x174ull << 40, + 0x175ull << 40, + 0x176ull << 40, + 0x177ull << 40, + 0x178ull << 40, + 0x179ull << 40, + + 0x10aull << 40, + 0x10bull << 40, + 0x12aull << 40, + 0x12bull << 40, + 0x14aull << 40, + 0x14bull << 40, + 0x16aull << 40, + 0x16bull << 40, + 0x14eull << 40, + 0x14full << 40, + + 0x11aull << 40, + 0x11bull << 40, + 0x13aull << 40, + 0x13bull << 40, + 0x15aull << 40, + 0x15bull << 40, + 0x17aull << 40, + 0x17bull << 40, + 0x15eull << 40, + 0x15full << 40, + + 0x180ull << 40, + 0x181ull << 40, + 0x182ull << 40, + 0x183ull << 40, + 0x184ull << 40, + 0x185ull << 40, + 0x186ull << 40, + 0x187ull << 40, + 0x188ull << 40, + 0x189ull << 40, + + 0x190ull << 40, + 0x191ull << 40, + 0x192ull << 40, + 0x193ull << 40, + 0x194ull << 40, + 0x195ull << 40, + 0x196ull << 40, + 0x197ull << 40, + 0x198ull << 40, + 0x199ull << 40, + + 0x1a0ull << 40, + 0x1a1ull << 40, + 0x1a2ull << 40, + 0x1a3ull << 40, + 0x1a4ull << 40, + 0x1a5ull << 40, + 0x1a6ull << 40, + 0x1a7ull << 40, + 0x1a8ull << 40, + 0x1a9ull << 40, + + 0x1b0ull << 40, + 0x1b1ull << 40, + 0x1b2ull << 40, + 0x1b3ull << 40, + 0x1b4ull << 40, + 0x1b5ull << 40, + 0x1b6ull << 40, + 0x1b7ull << 40, + 0x1b8ull << 40, + 0x1b9ull << 40, + + 0x1c0ull << 40, + 0x1c1ull << 40, + 0x1c2ull << 40, + 0x1c3ull << 40, + 0x1c4ull << 40, + 0x1c5ull << 40, + 0x1c6ull << 40, + 0x1c7ull << 40, + 0x1c8ull << 40, + 0x1c9ull << 40, + + 0x1d0ull << 40, + 0x1d1ull << 40, + 0x1d2ull << 40, + 0x1d3ull << 40, + 0x1d4ull << 40, + 0x1d5ull << 40, + 0x1d6ull << 40, + 0x1d7ull << 40, + 0x1d8ull << 40, + 0x1d9ull << 40, + + 0x1e0ull << 40, + 0x1e1ull << 40, + 0x1e2ull << 40, + 0x1e3ull << 40, + 0x1e4ull << 40, + 0x1e5ull << 40, + 0x1e6ull << 40, + 0x1e7ull << 40, + 0x1e8ull << 40, + 0x1e9ull << 40, + + 0x1f0ull << 40, + 0x1f1ull << 40, + 0x1f2ull << 40, + 0x1f3ull << 40, + 0x1f4ull << 40, + 0x1f5ull << 40, + 0x1f6ull << 40, + 0x1f7ull << 40, + 0x1f8ull << 40, + 0x1f9ull << 40, + + 0x18aull << 40, + 0x18bull << 40, + 0x1aaull << 40, + 0x1abull << 40, + 0x1caull << 40, + 0x1cbull << 40, + 0x1eaull << 40, + 0x1ebull << 40, + 0x1ceull << 40, + 0x1cfull << 40, + + 0x19aull << 40, + 0x19bull << 40, + 0x1baull << 40, + 0x1bbull << 40, + 0x1daull << 40, + 0x1dbull << 40, + 0x1faull << 40, + 0x1fbull << 40, + 0x1deull << 40, + 0x1dfull << 40, + + 0x200ull << 40, + 0x201ull << 40, + 0x202ull << 40, + 0x203ull << 40, + 0x204ull << 40, + 0x205ull << 40, + 0x206ull << 40, + 0x207ull << 40, + 0x208ull << 40, + 0x209ull << 40, + + 0x210ull << 40, + 0x211ull << 40, + 0x212ull << 40, + 0x213ull << 40, + 0x214ull << 40, + 0x215ull << 40, + 0x216ull << 40, + 0x217ull << 40, + 0x218ull << 40, + 0x219ull << 40, + + 0x220ull << 40, + 0x221ull << 40, + 0x222ull << 40, + 0x223ull << 40, + 0x224ull << 40, + 0x225ull << 40, + 0x226ull << 40, + 0x227ull << 40, + 0x228ull << 40, + 0x229ull << 40, + + 0x230ull << 40, + 0x231ull << 40, + 0x232ull << 40, + 0x233ull << 40, + 0x234ull << 40, + 0x235ull << 40, + 0x236ull << 40, + 0x237ull << 40, + 0x238ull << 40, + 0x239ull << 40, + + 0x240ull << 40, + 0x241ull << 40, + 0x242ull << 40, + 0x243ull << 40, + 0x244ull << 40, + 0x245ull << 40, + 0x246ull << 40, + 0x247ull << 40, + 0x248ull << 40, + 0x249ull << 40, + + 0x250ull << 40, + 0x251ull << 40, + 0x252ull << 40, + 0x253ull << 40, + 0x254ull << 40, + 0x255ull << 40, + 0x256ull << 40, + 0x257ull << 40, + 0x258ull << 40, + 0x259ull << 40, + + 0x260ull << 40, + 0x261ull << 40, + 0x262ull << 40, + 0x263ull << 40, + 0x264ull << 40, + 0x265ull << 40, + 0x266ull << 40, + 0x267ull << 40, + 0x268ull << 40, + 0x269ull << 40, + + 0x270ull << 40, + 0x271ull << 40, + 0x272ull << 40, + 0x273ull << 40, + 0x274ull << 40, + 0x275ull << 40, + 0x276ull << 40, + 0x277ull << 40, + 0x278ull << 40, + 0x279ull << 40, + + 0x20aull << 40, + 0x20bull << 40, + 0x22aull << 40, + 0x22bull << 40, + 0x24aull << 40, + 0x24bull << 40, + 0x26aull << 40, + 0x26bull << 40, + 0x24eull << 40, + 0x24full << 40, + + 0x21aull << 40, + 0x21bull << 40, + 0x23aull << 40, + 0x23bull << 40, + 0x25aull << 40, + 0x25bull << 40, + 0x27aull << 40, + 0x27bull << 40, + 0x25eull << 40, + 0x25full << 40, + + 0x280ull << 40, + 0x281ull << 40, + 0x282ull << 40, + 0x283ull << 40, + 0x284ull << 40, + 0x285ull << 40, + 0x286ull << 40, + 0x287ull << 40, + 0x288ull << 40, + 0x289ull << 40, + + 0x290ull << 40, + 0x291ull << 40, + 0x292ull << 40, + 0x293ull << 40, + 0x294ull << 40, + 0x295ull << 40, + 0x296ull << 40, + 0x297ull << 40, + 0x298ull << 40, + 0x299ull << 40, + + 0x2a0ull << 40, + 0x2a1ull << 40, + 0x2a2ull << 40, + 0x2a3ull << 40, + 0x2a4ull << 40, + 0x2a5ull << 40, + 0x2a6ull << 40, + 0x2a7ull << 40, + 0x2a8ull << 40, + 0x2a9ull << 40, + + 0x2b0ull << 40, + 0x2b1ull << 40, + 0x2b2ull << 40, + 0x2b3ull << 40, + 0x2b4ull << 40, + 0x2b5ull << 40, + 0x2b6ull << 40, + 0x2b7ull << 40, + 0x2b8ull << 40, + 0x2b9ull << 40, + + 0x2c0ull << 40, + 0x2c1ull << 40, + 0x2c2ull << 40, + 0x2c3ull << 40, + 0x2c4ull << 40, + 0x2c5ull << 40, + 0x2c6ull << 40, + 0x2c7ull << 40, + 0x2c8ull << 40, + 0x2c9ull << 40, + + 0x2d0ull << 40, + 0x2d1ull << 40, + 0x2d2ull << 40, + 0x2d3ull << 40, + 0x2d4ull << 40, + 0x2d5ull << 40, + 0x2d6ull << 40, + 0x2d7ull << 40, + 0x2d8ull << 40, + 0x2d9ull << 40, + + 0x2e0ull << 40, + 0x2e1ull << 40, + 0x2e2ull << 40, + 0x2e3ull << 40, + 0x2e4ull << 40, + 0x2e5ull << 40, + 0x2e6ull << 40, + 0x2e7ull << 40, + 0x2e8ull << 40, + 0x2e9ull << 40, + + 0x2f0ull << 40, + 0x2f1ull << 40, + 0x2f2ull << 40, + 0x2f3ull << 40, + 0x2f4ull << 40, + 0x2f5ull << 40, + 0x2f6ull << 40, + 0x2f7ull << 40, + 0x2f8ull << 40, + 0x2f9ull << 40, + + 0x28aull << 40, + 0x28bull << 40, + 0x2aaull << 40, + 0x2abull << 40, + 0x2caull << 40, + 0x2cbull << 40, + 0x2eaull << 40, + 0x2ebull << 40, + 0x2ceull << 40, + 0x2cfull << 40, + + 0x29aull << 40, + 0x29bull << 40, + 0x2baull << 40, + 0x2bbull << 40, + 0x2daull << 40, + 0x2dbull << 40, + 0x2faull << 40, + 0x2fbull << 40, + 0x2deull << 40, + 0x2dfull << 40, + + 0x300ull << 40, + 0x301ull << 40, + 0x302ull << 40, + 0x303ull << 40, + 0x304ull << 40, + 0x305ull << 40, + 0x306ull << 40, + 0x307ull << 40, + 0x308ull << 40, + 0x309ull << 40, + + 0x310ull << 40, + 0x311ull << 40, + 0x312ull << 40, + 0x313ull << 40, + 0x314ull << 40, + 0x315ull << 40, + 0x316ull << 40, + 0x317ull << 40, + 0x318ull << 40, + 0x319ull << 40, + + 0x320ull << 40, + 0x321ull << 40, + 0x322ull << 40, + 0x323ull << 40, + 0x324ull << 40, + 0x325ull << 40, + 0x326ull << 40, + 0x327ull << 40, + 0x328ull << 40, + 0x329ull << 40, + + 0x330ull << 40, + 0x331ull << 40, + 0x332ull << 40, + 0x333ull << 40, + 0x334ull << 40, + 0x335ull << 40, + 0x336ull << 40, + 0x337ull << 40, + 0x338ull << 40, + 0x339ull << 40, + + 0x340ull << 40, + 0x341ull << 40, + 0x342ull << 40, + 0x343ull << 40, + 0x344ull << 40, + 0x345ull << 40, + 0x346ull << 40, + 0x347ull << 40, + 0x348ull << 40, + 0x349ull << 40, + + 0x350ull << 40, + 0x351ull << 40, + 0x352ull << 40, + 0x353ull << 40, + 0x354ull << 40, + 0x355ull << 40, + 0x356ull << 40, + 0x357ull << 40, + 0x358ull << 40, + 0x359ull << 40, + + 0x360ull << 40, + 0x361ull << 40, + 0x362ull << 40, + 0x363ull << 40, + 0x364ull << 40, + 0x365ull << 40, + 0x366ull << 40, + 0x367ull << 40, + 0x368ull << 40, + 0x369ull << 40, + + 0x370ull << 40, + 0x371ull << 40, + 0x372ull << 40, + 0x373ull << 40, + 0x374ull << 40, + 0x375ull << 40, + 0x376ull << 40, + 0x377ull << 40, + 0x378ull << 40, + 0x379ull << 40, + + 0x30aull << 40, + 0x30bull << 40, + 0x32aull << 40, + 0x32bull << 40, + 0x34aull << 40, + 0x34bull << 40, + 0x36aull << 40, + 0x36bull << 40, + 0x34eull << 40, + 0x34full << 40, + + 0x31aull << 40, + 0x31bull << 40, + 0x33aull << 40, + 0x33bull << 40, + 0x35aull << 40, + 0x35bull << 40, + 0x37aull << 40, + 0x37bull << 40, + 0x35eull << 40, + 0x35full << 40, + + 0x380ull << 40, + 0x381ull << 40, + 0x382ull << 40, + 0x383ull << 40, + 0x384ull << 40, + 0x385ull << 40, + 0x386ull << 40, + 0x387ull << 40, + 0x388ull << 40, + 0x389ull << 40, + + 0x390ull << 40, + 0x391ull << 40, + 0x392ull << 40, + 0x393ull << 40, + 0x394ull << 40, + 0x395ull << 40, + 0x396ull << 40, + 0x397ull << 40, + 0x398ull << 40, + 0x399ull << 40, + + 0x3a0ull << 40, + 0x3a1ull << 40, + 0x3a2ull << 40, + 0x3a3ull << 40, + 0x3a4ull << 40, + 0x3a5ull << 40, + 0x3a6ull << 40, + 0x3a7ull << 40, + 0x3a8ull << 40, + 0x3a9ull << 40, + + 0x3b0ull << 40, + 0x3b1ull << 40, + 0x3b2ull << 40, + 0x3b3ull << 40, + 0x3b4ull << 40, + 0x3b5ull << 40, + 0x3b6ull << 40, + 0x3b7ull << 40, + 0x3b8ull << 40, + 0x3b9ull << 40, + + 0x3c0ull << 40, + 0x3c1ull << 40, + 0x3c2ull << 40, + 0x3c3ull << 40, + 0x3c4ull << 40, + 0x3c5ull << 40, + 0x3c6ull << 40, + 0x3c7ull << 40, + 0x3c8ull << 40, + 0x3c9ull << 40, + + 0x3d0ull << 40, + 0x3d1ull << 40, + 0x3d2ull << 40, + 0x3d3ull << 40, + 0x3d4ull << 40, + 0x3d5ull << 40, + 0x3d6ull << 40, + 0x3d7ull << 40, + 0x3d8ull << 40, + 0x3d9ull << 40, + + 0x3e0ull << 40, + 0x3e1ull << 40, + 0x3e2ull << 40, + 0x3e3ull << 40, + 0x3e4ull << 40, + 0x3e5ull << 40, + 0x3e6ull << 40, + 0x3e7ull << 40, + 0x3e8ull << 40, + 0x3e9ull << 40, + + 0x3f0ull << 40, + 0x3f1ull << 40, + 0x3f2ull << 40, + 0x3f3ull << 40, + 0x3f4ull << 40, + 0x3f5ull << 40, + 0x3f6ull << 40, + 0x3f7ull << 40, + 0x3f8ull << 40, + 0x3f9ull << 40, + + 0x38aull << 40, + 0x38bull << 40, + 0x3aaull << 40, + 0x3abull << 40, + 0x3caull << 40, + 0x3cbull << 40, + 0x3eaull << 40, + 0x3ebull << 40, + 0x3ceull << 40, + 0x3cfull << 40, + + 0x39aull << 40, + 0x39bull << 40, + 0x3baull << 40, + 0x3bbull << 40, + 0x3daull << 40, + 0x3dbull << 40, + 0x3faull << 40, + 0x3fbull << 40, + 0x3deull << 40, + 0x3dfull << 40, + + 0x00cull << 40, + 0x00dull << 40, + 0x10cull << 40, + 0x10dull << 40, + 0x20cull << 40, + 0x20dull << 40, + 0x30cull << 40, + 0x30dull << 40, + 0x02eull << 40, + 0x02full << 40, + + 0x01cull << 40, + 0x01dull << 40, + 0x11cull << 40, + 0x11dull << 40, + 0x21cull << 40, + 0x21dull << 40, + 0x31cull << 40, + 0x31dull << 40, + 0x03eull << 40, + 0x03full << 40, + + 0x02cull << 40, + 0x02dull << 40, + 0x12cull << 40, + 0x12dull << 40, + 0x22cull << 40, + 0x22dull << 40, + 0x32cull << 40, + 0x32dull << 40, + 0x12eull << 40, + 0x12full << 40, + + 0x03cull << 40, + 0x03dull << 40, + 0x13cull << 40, + 0x13dull << 40, + 0x23cull << 40, + 0x23dull << 40, + 0x33cull << 40, + 0x33dull << 40, + 0x13eull << 40, + 0x13full << 40, + + 0x04cull << 40, + 0x04dull << 40, + 0x14cull << 40, + 0x14dull << 40, + 0x24cull << 40, + 0x24dull << 40, + 0x34cull << 40, + 0x34dull << 40, + 0x22eull << 40, + 0x22full << 40, + + 0x05cull << 40, + 0x05dull << 40, + 0x15cull << 40, + 0x15dull << 40, + 0x25cull << 40, + 0x25dull << 40, + 0x35cull << 40, + 0x35dull << 40, + 0x23eull << 40, + 0x23full << 40, + + 0x06cull << 40, + 0x06dull << 40, + 0x16cull << 40, + 0x16dull << 40, + 0x26cull << 40, + 0x26dull << 40, + 0x36cull << 40, + 0x36dull << 40, + 0x32eull << 40, + 0x32full << 40, + + 0x07cull << 40, + 0x07dull << 40, + 0x17cull << 40, + 0x17dull << 40, + 0x27cull << 40, + 0x27dull << 40, + 0x37cull << 40, + 0x37dull << 40, + 0x33eull << 40, + 0x33full << 40, + + 0x00eull << 40, + 0x00full << 40, + 0x10eull << 40, + 0x10full << 40, + 0x20eull << 40, + 0x20full << 40, + 0x30eull << 40, + 0x30full << 40, + 0x06eull << 40, + 0x06full << 40, + + 0x01eull << 40, + 0x01full << 40, + 0x11eull << 40, + 0x11full << 40, + 0x21eull << 40, + 0x21full << 40, + 0x31eull << 40, + 0x31full << 40, + 0x07eull << 40, + 0x07full << 40, + + 0x08cull << 40, + 0x08dull << 40, + 0x18cull << 40, + 0x18dull << 40, + 0x28cull << 40, + 0x28dull << 40, + 0x38cull << 40, + 0x38dull << 40, + 0x0aeull << 40, + 0x0afull << 40, + + 0x09cull << 40, + 0x09dull << 40, + 0x19cull << 40, + 0x19dull << 40, + 0x29cull << 40, + 0x29dull << 40, + 0x39cull << 40, + 0x39dull << 40, + 0x0beull << 40, + 0x0bfull << 40, + + 0x0acull << 40, + 0x0adull << 40, + 0x1acull << 40, + 0x1adull << 40, + 0x2acull << 40, + 0x2adull << 40, + 0x3acull << 40, + 0x3adull << 40, + 0x1aeull << 40, + 0x1afull << 40, + + 0x0bcull << 40, + 0x0bdull << 40, + 0x1bcull << 40, + 0x1bdull << 40, + 0x2bcull << 40, + 0x2bdull << 40, + 0x3bcull << 40, + 0x3bdull << 40, + 0x1beull << 40, + 0x1bfull << 40, + + 0x0ccull << 40, + 0x0cdull << 40, + 0x1ccull << 40, + 0x1cdull << 40, + 0x2ccull << 40, + 0x2cdull << 40, + 0x3ccull << 40, + 0x3cdull << 40, + 0x2aeull << 40, + 0x2afull << 40, + + 0x0dcull << 40, + 0x0ddull << 40, + 0x1dcull << 40, + 0x1ddull << 40, + 0x2dcull << 40, + 0x2ddull << 40, + 0x3dcull << 40, + 0x3ddull << 40, + 0x2beull << 40, + 0x2bfull << 40, + + 0x0ecull << 40, + 0x0edull << 40, + 0x1ecull << 40, + 0x1edull << 40, + 0x2ecull << 40, + 0x2edull << 40, + 0x3ecull << 40, + 0x3edull << 40, + 0x3aeull << 40, + 0x3afull << 40, + + 0x0fcull << 40, + 0x0fdull << 40, + 0x1fcull << 40, + 0x1fdull << 40, + 0x2fcull << 40, + 0x2fdull << 40, + 0x3fcull << 40, + 0x3fdull << 40, + 0x3beull << 40, + 0x3bfull << 40, + + 0x08eull << 40, + 0x08full << 40, + 0x18eull << 40, + 0x18full << 40, + 0x28eull << 40, + 0x28full << 40, + 0x38eull << 40, + 0x38full << 40, + 0x0eeull << 40, + 0x0efull << 40, + + 0x09eull << 40, + 0x09full << 40, + 0x19eull << 40, + 0x19full << 40, + 0x29eull << 40, + 0x29full << 40, + 0x39eull << 40, + 0x39full << 40, + 0x0feull << 40, + 0x0ffull << 40 +}; + diff --git a/libdecnumber/bid/decimal128.c b/libdecnumber/bid/decimal128.c new file mode 100644 index 0000000..1daf5df --- /dev/null +++ b/libdecnumber/bid/decimal128.c @@ -0,0 +1,148 @@ +/* Copyright (C) 2007 + Free Software Foundation, Inc. + +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. */ + +/* As a special exception, if you link this library with other files, + some of which are compiled with GCC, to produce an executable, + this library does not by itself cause the resulting executable + to be covered by the GNU General Public License. + This exception does not however invalidate any other reasons why + the executable file might be covered by the GNU General Public License. */ + +#define decimal128FromString __dpd128FromString +#define decimal128ToString __dpd128ToString +#define decimal128ToEngString __dpd128ToEngString +#define decimal128FromNumber __dpd128FromNumber +#define decimal128ToNumber __dpd128ToNumber + +#include "dpd/decimal128.c" + +#undef decimal128FromString +#undef decimal128ToString +#undef decimal128ToEngString +#undef decimal128FromNumber +#undef decimal128ToNumber + +#include "bid-dpd.h" + +#ifdef IN_LIBGCC2 +#define decimal128FromString __decimal128FromString +#define decimal128ToString __decimal128ToString +#define decimal128ToEngString __decimal128ToEngString +#define decimal128FromNumber __decimal128FromNumber +#define decimal128ToNumber __decimal128ToNumber +#endif + +decimal128 *decimal128FromString (decimal128 *, const char *, decContext *); +char *decimal128ToString (const decimal128 *, char *); +char *decimal128ToEngString (const decimal128 *, char *); +decimal128 *decimal128FromNumber (decimal128 *, const decNumber *, decContext *); +decNumber *decimal128ToNumber (const decimal128 *, decNumber *); + +void __host_to_ieee_128 (_Decimal128 in, decimal128 *out); +void __ieee_to_host_128 (decimal128 in, _Decimal128 *out); + +decimal128 * +decimal128FromNumber (decimal128 *d128, const decNumber *dn, + decContext *set) +{ + /* decimal128 and _Decimal128 are different types. */ + union + { + _Decimal128 _Dec; + decimal128 dec; + } u; + + __dpd128FromNumber (d128, dn, set); + + /* __dpd128FromNumber returns in big endian. But _dpd_to_bid128 takes + host endian. */ + __ieee_to_host_128 (*d128, &u._Dec); + + /* Convert DPD to BID. */ + _dpd_to_bid128 (&u._Dec, &u._Dec); + + /* dfp.c is in bid endian. */ + __host_to_ieee_128 (u._Dec, &u.dec); + + /* d128 is returned as a pointer to _Decimal128 here. */ + *d128 = u.dec; + + return d128; +} + +decNumber * +decimal128ToNumber (const decimal128 *bid128, decNumber *dn) +{ + /* decimal128 and _Decimal128 are different types. */ + union + { + _Decimal128 _Dec; + decimal128 dec; + } u; + + /* bid128 is a pointer to _Decimal128 in bid endian. But _bid_to_dpd128 + takes host endian. */ + __ieee_to_host_128 (*bid128, &u._Dec); + + /* Convert BID to DPD. */ + _bid_to_dpd128 (&u._Dec, &u._Dec); + + /* __dpd128ToNumber is in bid endian. */ + __host_to_ieee_128 (u._Dec, &u.dec); + + return __dpd128ToNumber (&u.dec, dn); +} + +char * +decimal128ToString (const decimal128 *d128, char *string) +{ + decNumber dn; /* work */ + decimal128ToNumber (d128, &dn); + decNumberToString (&dn, string); + return string; +} + +char * +decimal128ToEngString (const decimal128 *d128, char *string) +{ + decNumber dn; /* work */ + decimal128ToNumber (d128, &dn); + decNumberToEngString (&dn, string); + return string; +} + +decimal128 * +decimal128FromString (decimal128 *result, const char *string, + decContext *set) +{ + decContext dc; /* work */ + decNumber dn; /* .. */ + + decContextDefault (&dc, DEC_INIT_DECIMAL128); /* no traps, please */ + dc.round = set->round; /* use supplied rounding */ + + decNumberFromString (&dn, string, &dc); /* will round if needed */ + decimal128FromNumber (result, &dn, &dc); + if (dc.status != 0) + { /* something happened */ + decContextSetStatus (set, dc.status); /* .. pass it on */ + } + return result; +} diff --git a/libdecnumber/bid/decimal128.h b/libdecnumber/bid/decimal128.h new file mode 100644 index 0000000..1387352 --- /dev/null +++ b/libdecnumber/bid/decimal128.h @@ -0,0 +1 @@ +#include "dpd/decimal128.h" diff --git a/libdecnumber/bid/decimal32.c b/libdecnumber/bid/decimal32.c new file mode 100644 index 0000000..68e004e --- /dev/null +++ b/libdecnumber/bid/decimal32.c @@ -0,0 +1,148 @@ +/* Copyright (C) 2007 + Free Software Foundation, Inc. + +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. */ + +/* As a special exception, if you link this library with other files, + some of which are compiled with GCC, to produce an executable, + this library does not by itself cause the resulting executable + to be covered by the GNU General Public License. + This exception does not however invalidate any other reasons why + the executable file might be covered by the GNU General Public License. */ + +#define decimal32FromString __dpd32FromString +#define decimal32ToString __dpd32ToString +#define decimal32ToEngString __dpd32ToEngString +#define decimal32FromNumber __dpd32FromNumber +#define decimal32ToNumber __dpd32ToNumber + +#include "dpd/decimal32.c" + +#undef decimal32FromString +#undef decimal32ToString +#undef decimal32ToEngString +#undef decimal32FromNumber +#undef decimal32ToNumber + +#include "bid-dpd.h" + +#ifdef IN_LIBGCC2 +#define decimal32FromString __decimal32FromString +#define decimal32ToString __decimal32ToString +#define decimal32ToEngString __decimal32ToEngString +#define decimal32FromNumber __decimal32FromNumber +#define decimal32ToNumber __decimal32ToNumber +#endif + +decimal32 *decimal32FromString (decimal32 *, const char *, decContext *); +char *decimal32ToString (const decimal32 *, char *); +char *decimal32ToEngString (const decimal32 *, char *); +decimal32 *decimal32FromNumber (decimal32 *, const decNumber *, decContext *); +decNumber *decimal32ToNumber (const decimal32 *, decNumber *); + +void __host_to_ieee_32 (_Decimal32 in, decimal32 *out); +void __ieee_to_host_32 (decimal32 in, _Decimal32 *out); + +decimal32 * +decimal32FromNumber (decimal32 *d32, const decNumber *dn, + decContext *set) +{ + /* decimal32 and _Decimal32 are different types. */ + union + { + _Decimal32 _Dec; + decimal32 dec; + } u; + + __dpd32FromNumber (d32, dn, set); + + /* __dpd32FromNumber returns in big endian. But _dpd_to_bid32 takes + host endian. */ + __ieee_to_host_32 (*d32, &u._Dec); + + /* Convert DPD to BID. */ + _dpd_to_bid32 (&u._Dec, &u._Dec); + + /* dfp.c is in bid endian. */ + __host_to_ieee_32 (u._Dec, &u.dec); + + /* d32 is returned as a pointer to _Decimal32 here. */ + *d32 = u.dec; + + return d32; +} + +decNumber * +decimal32ToNumber (const decimal32 *bid32, decNumber *dn) +{ + /* decimal32 and _Decimal32 are different types. */ + union + { + _Decimal32 _Dec; + decimal32 dec; + } u; + + /* bid32 is a pointer to _Decimal32 in bid endian. But _bid_to_dpd32 + takes host endian. */ + __ieee_to_host_32 (*bid32, &u._Dec); + + /* Convert BID to DPD. */ + _bid_to_dpd32 (&u._Dec, &u._Dec); + + /* __dpd32ToNumber is in bid endian. */ + __host_to_ieee_32 (u._Dec, &u.dec); + + return __dpd32ToNumber (&u.dec, dn); +} + +char * +decimal32ToString (const decimal32 *d32, char *string) +{ + decNumber dn; /* work */ + decimal32ToNumber (d32, &dn); + decNumberToString (&dn, string); + return string; +} + +char * +decimal32ToEngString (const decimal32 *d32, char *string) +{ + decNumber dn; /* work */ + decimal32ToNumber (d32, &dn); + decNumberToEngString (&dn, string); + return string; +} + +decimal32 * +decimal32FromString (decimal32 *result, const char *string, + decContext *set) +{ + decContext dc; /* work */ + decNumber dn; /* .. */ + + decContextDefault (&dc, DEC_INIT_DECIMAL32); /* no traps, please */ + dc.round = set->round; /* use supplied rounding */ + + decNumberFromString (&dn, string, &dc); /* will round if needed */ + decimal32FromNumber (result, &dn, &dc); + if (dc.status != 0) + { /* something happened */ + decContextSetStatus (set, dc.status); /* .. pass it on */ + } + return result; +} diff --git a/libdecnumber/bid/decimal32.h b/libdecnumber/bid/decimal32.h new file mode 100644 index 0000000..e12e3b1 --- /dev/null +++ b/libdecnumber/bid/decimal32.h @@ -0,0 +1 @@ +#include "dpd/decimal32.h" diff --git a/libdecnumber/bid/decimal64.c b/libdecnumber/bid/decimal64.c new file mode 100644 index 0000000..bdbee38 --- /dev/null +++ b/libdecnumber/bid/decimal64.c @@ -0,0 +1,148 @@ +/* Copyright (C) 2007 + Free Software Foundation, Inc. + +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. */ + +/* As a special exception, if you link this library with other files, + some of which are compiled with GCC, to produce an executable, + this library does not by itself cause the resulting executable + to be covered by the GNU General Public License. + This exception does not however invalidate any other reasons why + the executable file might be covered by the GNU General Public License. */ + +#define decimal64FromString __dpd64FromString +#define decimal64ToString __dpd64ToString +#define decimal64ToEngString __dpd64ToEngString +#define decimal64FromNumber __dpd64FromNumber +#define decimal64ToNumber __dpd64ToNumber + +#include "dpd/decimal64.c" + +#undef decimal64FromString +#undef decimal64ToString +#undef decimal64ToEngString +#undef decimal64FromNumber +#undef decimal64ToNumber + +#include "bid-dpd.h" + +#ifdef IN_LIBGCC2 +#define decimal64FromString __decimal64FromString +#define decimal64ToString __decimal64ToString +#define decimal64ToEngString __decimal64ToEngString +#define decimal64FromNumber __decimal64FromNumber +#define decimal64ToNumber __decimal64ToNumber +#endif + +decimal64 *decimal64FromString (decimal64 *, const char *, decContext *); +char *decimal64ToString (const decimal64 *, char *); +char *decimal64ToEngString (const decimal64 *, char *); +decimal64 *decimal64FromNumber (decimal64 *, const decNumber *, decContext *); +decNumber *decimal64ToNumber (const decimal64 *, decNumber *); + +void __host_to_ieee_64 (_Decimal64 in, decimal64 *out); +void __ieee_to_host_64 (decimal64 in, _Decimal64 *out); + +decimal64 * +decimal64FromNumber (decimal64 *d64, const decNumber *dn, + decContext *set) +{ + /* decimal64 and _Decimal64 are different types. */ + union + { + _Decimal64 _Dec; + decimal64 dec; + } u; + + __dpd64FromNumber (d64, dn, set); + + /* __dpd64FromNumber returns in big endian. But _dpd_to_bid64 takes + host endian. */ + __ieee_to_host_64 (*d64, &u._Dec); + + /* Convert DPD to BID. */ + _dpd_to_bid64 (&u._Dec, &u._Dec); + + /* dfp.c is in bid endian. */ + __host_to_ieee_64 (u._Dec, &u.dec); + + /* d64 is returned as a pointer to _Decimal64 here. */ + *d64 = u.dec; + + return d64; +} + +decNumber * +decimal64ToNumber (const decimal64 *bid64, decNumber *dn) +{ + /* decimal64 and _Decimal64 are different types. */ + union + { + _Decimal64 _Dec; + decimal64 dec; + } u; + + /* bid64 is a pointer to _Decimal64 in bid endian. But _bid_to_dpd64 + takes host endian. */ + __ieee_to_host_64 (*bid64, &u._Dec); + + /* Convert BID to DPD. */ + _bid_to_dpd64 (&u._Dec, &u._Dec); + + /* __dpd64ToNumber is in bid endian. */ + __host_to_ieee_64 (u._Dec, &u.dec); + + return __dpd64ToNumber (&u.dec, dn); +} + +char * +decimal64ToString (const decimal64 *d64, char *string) +{ + decNumber dn; /* work */ + decimal64ToNumber (d64, &dn); + decNumberToString (&dn, string); + return string; +} + +char * +decimal64ToEngString (const decimal64 *d64, char *string) +{ + decNumber dn; /* work */ + decimal64ToNumber (d64, &dn); + decNumberToEngString (&dn, string); + return string; +} + +decimal64 * +decimal64FromString (decimal64 *result, const char *string, + decContext *set) +{ + decContext dc; /* work */ + decNumber dn; /* .. */ + + decContextDefault (&dc, DEC_INIT_DECIMAL64); /* no traps, please */ + dc.round = set->round; /* use supplied rounding */ + + decNumberFromString (&dn, string, &dc); /* will round if needed */ + decimal64FromNumber (result, &dn, &dc); + if (dc.status != 0) + { /* something happened */ + decContextSetStatus (set, dc.status); /* .. pass it on */ + } + return result; +} diff --git a/libdecnumber/bid/decimal64.h b/libdecnumber/bid/decimal64.h new file mode 100644 index 0000000..94d4d0c --- /dev/null +++ b/libdecnumber/bid/decimal64.h @@ -0,0 +1 @@ +#include "dpd/decimal64.h" diff --git a/libdecnumber/bid/host-ieee128.c b/libdecnumber/bid/host-ieee128.c new file mode 100644 index 0000000..2c8ea32 --- /dev/null +++ b/libdecnumber/bid/host-ieee128.c @@ -0,0 +1,82 @@ +/* This is a software decimal floating point library. + Copyright (C) 2007 Free Software Foundation, Inc. + +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. + +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file into combinations with other programs, +and to distribute those combinations without any restriction coming +from the use of this file. (The General Public License restrictions +do apply in other respects; for example, they cover modification of +the file, and distribution when not linked into a combine +executable.) + +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. */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <limits.h> + +#include "config.h" +#include "gstdint.h" +#include "bid-dpd.h" +#include "decimal128.h" + +extern uint32_t __dec_byte_swap (uint32_t); +void __host_to_ieee_128 (_Decimal128 in, decimal128 *out); +void __ieee_to_host_128 (decimal128 in, _Decimal128 *out); + +#ifndef WORDS_BIGENDIAN +#define WORDS_BIGENDIAN 0 +#endif + +static void +__swap128 (char *src, char *dst) +{ + uint32_t t1, t2, t3, t4; + + if (!WORDS_BIGENDIAN) + { + memcpy (&t1, src, 4); + memcpy (&t2, src + 4, 4); + memcpy (&t3, src + 8, 4); + memcpy (&t4, src + 12, 4); + t1 = __dec_byte_swap (t1); + t2 = __dec_byte_swap (t2); + t3 = __dec_byte_swap (t3); + t4 = __dec_byte_swap (t4); + memcpy (dst, &t4, 4); + memcpy (dst + 4, &t3, 4); + memcpy (dst + 8, &t2, 4); + memcpy (dst + 12, &t1, 4); + } + else + memcpy (dst, src, 16); +} + +void +__host_to_ieee_128 (_Decimal128 in, decimal128 *out) +{ + __swap128 ((char *) &in, (char *) out); +} + +void +__ieee_to_host_128 (decimal128 in, _Decimal128 *out) +{ + __swap128 ((char *) &in, (char *) out); +} diff --git a/libdecnumber/bid/host-ieee32.c b/libdecnumber/bid/host-ieee32.c new file mode 100644 index 0000000..639662e --- /dev/null +++ b/libdecnumber/bid/host-ieee32.c @@ -0,0 +1,105 @@ +/* This is a software decimal floating point library. + Copyright (C) 2007 Free Software Foundation, Inc. + +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. + +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file into combinations with other programs, +and to distribute those combinations without any restriction coming +from the use of this file. (The General Public License restrictions +do apply in other respects; for example, they cover modification of +the file, and distribution when not linked into a combine +executable.) + +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. */ + +/* This implements IEEE 754R decimal floating point arithmetic, but + does not provide a mechanism for setting the rounding mode, or for + generating or handling exceptions. Conversions between decimal + floating point types and other types depend on C library functions. + + Contributed by Ben Elliston <bje@au.ibm.com>. */ + +/* The intended way to use this file is to make two copies, add `#define ' + to one copy, then compile both copies and add them to libgcc.a. */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <limits.h> + +#include "config.h" +#include "gstdint.h" +#include "bid-dpd.h" +#include "decimal32.h" + +uint32_t __dec_byte_swap (uint32_t); +void __host_to_ieee_32 (_Decimal32 in, decimal32 *out); +void __ieee_to_host_32 (decimal32 in, _Decimal32 *out); + +#ifndef WORDS_BIGENDIAN +#define WORDS_BIGENDIAN 0 +#endif + +uint32_t +__dec_byte_swap (uint32_t in) +{ + uint32_t out = 0; + unsigned char *p = (unsigned char *) &out; + union { + uint32_t i; + unsigned char b[4]; + } u; + + u.i = in; + p[0] = u.b[3]; + p[1] = u.b[2]; + p[2] = u.b[1]; + p[3] = u.b[0]; + + return out; +} + +void +__host_to_ieee_32 (_Decimal32 in, decimal32 *out) +{ + uint32_t t; + + if (!WORDS_BIGENDIAN) + { + memcpy (&t, &in, 4); + t = __dec_byte_swap (t); + memcpy (out, &t, 4); + } + else + memcpy (out, &in, 4); +} + +void +__ieee_to_host_32 (decimal32 in, _Decimal32 *out) +{ + uint32_t t; + + if (!WORDS_BIGENDIAN) + { + memcpy (&t, &in, 4); + t = __dec_byte_swap (t); + memcpy (out, &t, 4); + } + else + memcpy (out, &in, 4); +} diff --git a/libdecnumber/bid/host-ieee64.c b/libdecnumber/bid/host-ieee64.c new file mode 100644 index 0000000..3c98985 --- /dev/null +++ b/libdecnumber/bid/host-ieee64.c @@ -0,0 +1,86 @@ +/* This is a software decimal floating point library. + Copyright (C) 2007 Free Software Foundation, Inc. + +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. + +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file into combinations with other programs, +and to distribute those combinations without any restriction coming +from the use of this file. (The General Public License restrictions +do apply in other respects; for example, they cover modification of +the file, and distribution when not linked into a combine +executable.) + +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. */ + +/* This implements IEEE 754R decimal floating point arithmetic, but + does not provide a mechanism for setting the rounding mode, or for + generating or handling exceptions. Conversions between decimal + floating point types and other types depend on C library functions. + + Contributed by Ben Elliston <bje@au.ibm.com>. */ + +/* The intended way to use this file is to make two copies, add `#define ' + to one copy, then compile both copies and add them to libgcc.a. */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <limits.h> + +#include "config.h" +#include "gstdint.h" +#include "bid-dpd.h" +#include "decimal64.h" + +uint32_t __dec_byte_swap (uint32_t); +void __host_to_ieee_64 (_Decimal64 in, decimal64 *out); +void __ieee_to_host_64 (decimal64 in, _Decimal64 *out); + +#ifndef WORDS_BIGENDIAN +#define WORDS_BIGENDIAN 0 +#endif + +static void +__swap64 (char *src, char *dst) +{ + uint32_t t1, t2; + + if (!WORDS_BIGENDIAN) + { + memcpy (&t1, src, 4); + memcpy (&t2, src + 4, 4); + t1 = __dec_byte_swap (t1); + t2 = __dec_byte_swap (t2); + memcpy (dst, &t2, 4); + memcpy (dst + 4, &t1, 4); + } + else + memcpy (dst, src, 8); +} + +void +__host_to_ieee_64 (_Decimal64 in, decimal64 *out) +{ + __swap64 ((char *) &in, (char *) out); +} + +void +__ieee_to_host_64 (decimal64 in, _Decimal64 *out) +{ + __swap64 ((char *) &in, (char *) out); +} diff --git a/libdecnumber/config.in b/libdecnumber/config.in index 1d4e9a3..b25b9e9 100644 --- a/libdecnumber/config.in +++ b/libdecnumber/config.in @@ -69,6 +69,10 @@ /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN + /* Define to empty if `const' does not conform to ANSI C. */ #undef const diff --git a/libdecnumber/configure b/libdecnumber/configure index f9cb0ef..4079e4b 100755 --- a/libdecnumber/configure +++ b/libdecnumber/configure @@ -311,7 +311,7 @@ ac_includes_default="\ # include <unistd.h> #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT RANLIB ac_ct_RANLIB ACLOCAL AUTOCONF AUTOHEADER WARN_CFLAGS WARN_PEDANTIC WERROR CPP EGREP MAINT LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT RANLIB ac_ct_RANLIB ACLOCAL AUTOCONF AUTOHEADER WARN_CFLAGS WARN_PEDANTIC WERROR CPP EGREP MAINT enable_decimal_float LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -846,6 +846,10 @@ Optional Features: --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-werror-always enable -Werror despite compiler version --enable-maintainer-mode enable rules only needed by maintainers + --enable-decimal-float={no,yes,bid,dpd} + enable decimal float extension to C. Selecting 'bid' + or 'dpd' choses which decimal floating point format + to use Some influential environment variables: CC C compiler command @@ -2616,7 +2620,7 @@ fi echo "$as_me:$LINENO: result: $acx_cv_prog_cc_pedantic__Wno_long_long" >&5 echo "${ECHO_T}$acx_cv_prog_cc_pedantic__Wno_long_long" >&6 if test $acx_cv_prog_cc_pedantic__Wno_long_long = yes; then - WARN_PEDANTIC="-pedantic -Wno-long-long" + WARN_PEDANTIC="$WARN_PEDANTIC${WARN_PEDANTIC:+ }-pedantic -Wno-long-long" fi @@ -2635,11 +2639,12 @@ else enable_werror_always=no fi; if test $enable_werror_always = yes; then - WERROR=-Werror + WERROR="$WERROR${WERROR:+ }-Werror" fi + # Checks for header files. ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -7316,6 +7321,285 @@ else fi +# Default decimal format +# If you change the defaults here, be sure to change them in the GCC directory also +echo "$as_me:$LINENO: checking for decimal floating point" >&5 +echo $ECHO_N "checking for decimal floating point... $ECHO_C" >&6 +# Check whether --enable-decimal-float or --disable-decimal-float was given. +if test "${enable_decimal_float+set}" = set; then + enableval="$enable_decimal_float" + + case $enable_decimal_float in + yes | no | bid | dpd) ;; + *) { { echo "$as_me:$LINENO: error: '$enable_decimal_float' is an invalid value for --enable-decimal-float. +Valid choices are 'yes', 'bid', 'dpd', and 'no'." >&5 +echo "$as_me: error: '$enable_decimal_float' is an invalid value for --enable-decimal-float. +Valid choices are 'yes', 'bid', 'dpd', and 'no'." >&2;} + { (exit 1); exit 1; }; } ;; + esac + +else + + case $target in + powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux*) + enable_decimal_float=yes + ;; + *) + enable_decimal_float=no + ;; + esac + +fi; + +# x86's use BID format instead of DPD +# In theory --enable-decimal-float=no should not compile anything +# For the sake of simplicity, just use the default format in this directory +if test x$enable_decimal_float = xyes -o x$enable_decimal_float = xno; then + case $target in + i?86*-*-linux* | x86_64*-*-linux*) + enable_decimal_float=bid + ;; + *) + enable_decimal_float=dpd + ;; + esac +fi + +echo "$as_me:$LINENO: result: $enable_decimal_float" >&5 +echo "${ECHO_T}$enable_decimal_float" >&6 + + +echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 +if test "${ac_cv_c_bigendian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # See if sys/param.h defines the BYTE_ORDER macro. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <sys/param.h> + +int +main () +{ +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + # It does; now see whether it defined to BIG_ENDIAN or not. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <sys/param.h> + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_bigendian=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +# It does not; compile a test program. +if test "$cross_compiling" = yes; then + # try to guess the endianness by grepping values into an object file + ac_cv_c_bigendian=unknown + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } +int +main () +{ + _ascii (); _ebcdic (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then + ac_cv_c_bigendian=yes +fi +if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +int +main () +{ + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (u.c[sizeof (long) - 1] == 1); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=no +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_c_bigendian=yes +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6 +case $ac_cv_c_bigendian in + yes) + +cat >>confdefs.h <<\_ACEOF +#define WORDS_BIGENDIAN 1 +_ACEOF + ;; + no) + ;; + *) + { { echo "$as_me:$LINENO: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&5 +echo "$as_me: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} + { (exit 1); exit 1; }; } ;; +esac + + # Output. ac_config_headers="$ac_config_headers config.h:config.in" @@ -7980,6 +8264,7 @@ s,@WERROR@,$WERROR,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t s,@MAINT@,$MAINT,;t t +s,@enable_decimal_float@,$enable_decimal_float,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF diff --git a/libdecnumber/configure.ac b/libdecnumber/configure.ac index 90884a8..ed56e2c 100644 --- a/libdecnumber/configure.ac +++ b/libdecnumber/configure.ac @@ -71,6 +71,51 @@ else fi AC_SUBST(MAINT) +# Default decimal format +# If you change the defaults here, be sure to change them in the GCC directory also +AC_MSG_CHECKING([for decimal floating point]) +AC_ARG_ENABLE(decimal-float, +[ --enable-decimal-float={no,yes,bid,dpd} + enable decimal float extension to C. Selecting 'bid' + or 'dpd' choses which decimal floating point format + to use], +[ + case $enable_decimal_float in + yes | no | bid | dpd) ;; + *) AC_MSG_ERROR(['$enable_decimal_float' is an invalid value for --enable-decimal-float. +Valid choices are 'yes', 'bid', 'dpd', and 'no'.]) ;; + esac +], +[ + case $target in + powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux*) + enable_decimal_float=yes + ;; + *) + enable_decimal_float=no + ;; + esac +]) + +# x86's use BID format instead of DPD +# In theory --enable-decimal-float=no should not compile anything +# For the sake of simplicity, just use the default format in this directory +if test x$enable_decimal_float = xyes -o x$enable_decimal_float = xno; then + case $target in + i?86*-*-linux* | x86_64*-*-linux*) + enable_decimal_float=bid + ;; + *) + enable_decimal_float=dpd + ;; + esac +fi + +AC_MSG_RESULT($enable_decimal_float) +AC_SUBST(enable_decimal_float) + +AC_C_BIGENDIAN + # Output. AC_CONFIG_HEADERS(config.h:config.in, [echo timestamp > stamp-h1]) diff --git a/libdecnumber/decimal128.c b/libdecnumber/dpd/decimal128.c index 92b4f61..92b4f61 100644 --- a/libdecnumber/decimal128.c +++ b/libdecnumber/dpd/decimal128.c diff --git a/libdecnumber/decimal128.h b/libdecnumber/dpd/decimal128.h index bcc75a1..a6bc87b 100644 --- a/libdecnumber/decimal128.h +++ b/libdecnumber/dpd/decimal128.h @@ -90,6 +90,12 @@ typedef struct #define decimal128SetSign(d, b) { \ (d)->bytes[0]|=((unsigned)(b)<<7);} + /* Clear sign */ +#define decimal128ClearSign(d) {(d)->bytes[0]&=~0x80;} + + /* Flip sign */ +#define decimal128FlipSign(d) {(d)->bytes[0]^=0x80;} + /* Set exponent continuation [does not apply bias] */ /* This assumes range has been checked and exponent previously 0; */ /* type of exponent must be unsigned */ @@ -103,12 +109,14 @@ typedef struct /* ------------------------------------------------------------------ */ #ifdef IN_LIBGCC2 +#ifndef decimal128FromString #define decimal128FromString __decimal128FromString #define decimal128ToString __decimal128ToString #define decimal128ToEngString __decimal128ToEngString #define decimal128FromNumber __decimal128FromNumber #define decimal128ToNumber __decimal128ToNumber #endif +#endif /* String conversions */ decimal128 *decimal128FromString (decimal128 *, const char *, decContext *); diff --git a/libdecnumber/decimal32.c b/libdecnumber/dpd/decimal32.c index 8691286..8691286 100644 --- a/libdecnumber/decimal32.c +++ b/libdecnumber/dpd/decimal32.c diff --git a/libdecnumber/decimal32.h b/libdecnumber/dpd/decimal32.h index bb22824..cbe8ab4 100644 --- a/libdecnumber/decimal32.h +++ b/libdecnumber/dpd/decimal32.h @@ -81,6 +81,12 @@ typedef struct #define decimal32SetSign(d, b) { \ (d)->bytes[0]|=((unsigned)(b)<<7);} + /* Clear sign */ +#define decimal32ClearSign(d) {(d)->bytes[0]&=~0x80;} + + /* Flip sign */ +#define decimal32FlipSign(d) {(d)->bytes[0]^=0x80;} + /* Set exponent continuation [does not apply bias] */ /* This assumes range has been checked and exponent previously 0; */ /* type of exponent must be unsigned */ @@ -93,12 +99,14 @@ typedef struct /* ------------------------------------------------------------------ */ #ifdef IN_LIBGCC2 +#ifndef decimal32FromString #define decimal32FromString __decimal32FromString #define decimal32ToString __decimal32ToString #define decimal32ToEngString __decimal32ToEngString #define decimal32FromNumber __decimal32FromNumber #define decimal32ToNumber __decimal32ToNumber #endif +#endif /* String conversions. */ decimal32 *decimal32FromString (decimal32 *, const char *, decContext *); diff --git a/libdecnumber/decimal64.c b/libdecnumber/dpd/decimal64.c index c1c1c7c..c1c1c7c 100644 --- a/libdecnumber/decimal64.c +++ b/libdecnumber/dpd/decimal64.c diff --git a/libdecnumber/decimal64.h b/libdecnumber/dpd/decimal64.h index 2c7131c..fb73395 100644 --- a/libdecnumber/decimal64.h +++ b/libdecnumber/dpd/decimal64.h @@ -85,6 +85,12 @@ typedef struct #define decimal64SetSign(d, b) { \ (d)->bytes[0]|=((unsigned)(b)<<7);} + /* Clear sign */ +#define decimal64ClearSign(d) {(d)->bytes[0]&=~0x80;} + + /* Flip sign */ +#define decimal64FlipSign(d) {(d)->bytes[0]^=0x80;} + /* Set exponent continuation [does not apply bias] */ /* This assumes range has been checked and exponent previously 0; type */ /* of exponent must be unsigned */ @@ -97,12 +103,14 @@ typedef struct /* ------------------------------------------------------------------ */ #ifdef IN_LIBGCC2 +#ifndef decimal64FromString #define decimal64FromString __decimal64FromString #define decimal64ToString __decimal64ToString #define decimal64ToEngString __decimal64ToEngString #define decimal64FromNumber __decimal64FromNumber #define decimal64ToNumber __decimal64ToNumber #endif +#endif /* String conversions */ decimal64 *decimal64FromString (decimal64 *, const char *, decContext *); diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 4b42b2c..4271a401 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,18 @@ +2007-03-23 Michael Meissner <michael.meissner@amd.com> + H.J. Lu <hongjiu.lu@intel.com> + + * Makefile.in (enable_decimal_float): New. + (DECNUMINC): Add + -I$(srcdir)/../libdecnumber/$(enable_decimal_float). + (dec-objects): Move decimal32, decimal64 and decimal128 to ... + (decbits-filenames): This. + (decbits-objects): New. + (libgcc-objects): Add $(decbits-objects). + + * configure.ac: Support * --enable-decimal-float={no,yes,bid,dpd}. + Substitute enable_decimal_float. + * configure: Regenerated. + 2007-03-19 Hans-Peter Nilsson <hp@axis.com> * config.host (cris-*-elf | cris-*-none): Set extra_parts. diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in index 63c9512..684c80a 100644 --- a/libgcc/Makefile.in +++ b/libgcc/Makefile.in @@ -37,6 +37,7 @@ SHELL = @SHELL@ enable_shared = @enable_shared@ decimal_float = @decimal_float@ +enable_decimal_float = @enable_decimal_float@ host_noncanonical = @host_noncanonical@ @@ -183,7 +184,13 @@ export slibdir version := $(shell $(CC) -dumpversion) -DECNUMINC = -I$(srcdir)/../libdecnumber -I$(MULTIBUILDTOP)../../libdecnumber +ifeq ($(decimal_float),yes) +DECNUMINC = -I$(srcdir)/../libdecnumber/$(enable_decimal_float) \ + -I$(srcdir)/../libdecnumber \ + -I$(MULTIBUILDTOP)../../libdecnumber +else +DECNUMINC = +endif # Specify the directories to be searched for header files. # Both . and srcdir are used, in that order, @@ -467,22 +474,32 @@ ifneq ($(D32PBIT)$(D64PBIT)$(D128PBIT),) dec-filenames += decContext decNumber decExcept decRound decLibrary decUtility endif +dec-objects = $(patsubst %,%$(objext),$(dec-filenames)) +$(dec-objects): %$(objext): $(srcdir)/../libdecnumber/%.c + $(gcc_compile) -c $< +libgcc-objects += $(dec-objects) + +decbits-filenames = ifneq ($(D32PBIT),) -dec-filenames += decimal32 +decbits-filenames += decimal32 endif ifneq ($(D64PBIT),) -dec-filenames += decimal64 +decbits-filenames += decimal64 endif ifneq ($(D128PBIT),) -dec-filenames += decimal128 +decbits-filenames += decimal128 endif -dec-objects = $(patsubst %,%$(objext),$(dec-filenames)) -$(dec-objects): %$(objext): $(srcdir)/../libdecnumber/%.c +ifeq ($(enable_decimal_float),bid) +decbits-filenames += bid2dpd_dpd2bid +endif + +decbits-objects = $(patsubst %,%$(objext),$(decbits-filenames)) +$(decbits-objects): %$(objext): $(srcdir)/../libdecnumber/$(enable_decimal_float)/%.c $(gcc_compile) -c $< -libgcc-objects += $(dec-objects) +libgcc-objects += $(decbits-objects) # Next build individual support functions. ifneq ($(D32PBIT),) diff --git a/libgcc/configure b/libgcc/configure index b90dfa1..492e976 100644 --- a/libgcc/configure +++ b/libgcc/configure @@ -272,7 +272,7 @@ PACKAGE_STRING='GNU C Runtime Library 1.0' PACKAGE_BUGREPORT='' ac_unique_file="static-object.mk" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libgcc_topdir enable_shared slibdir INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA AWK build build_cpu build_vendor build_os host host_cpu host_vendor host_os host_noncanonical build_libsubdir build_subdir host_subdir target_subdir AR ac_ct_AR LIPO ac_ct_LIPO NM ac_ct_NM RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP decimal_float vis_hide tmake_file extra_parts asm_hidden_op LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libgcc_topdir enable_shared slibdir INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA AWK build build_cpu build_vendor build_os host host_cpu host_vendor host_os host_noncanonical build_libsubdir build_subdir host_subdir target_subdir AR ac_ct_AR LIPO ac_ct_LIPO NM ac_ct_NM RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP decimal_float enable_decimal_float vis_hide tmake_file extra_parts asm_hidden_op LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -811,6 +811,10 @@ Optional Features: --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-shared don't provide a shared libgcc --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory + --enable-decimal-float={no,yes,bid,dpd} + enable decimal float extension to C. Selecting 'bid' + or 'dpd' choses which decimal floating point format + to use Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -3286,6 +3290,45 @@ echo "${ECHO_T}$libgcc_cv_dfp" >&6 decimal_float=$libgcc_cv_dfp +# Check whether --enable-decimal-float or --disable-decimal-float was given. +if test "${enable_decimal_float+set}" = set; then + enableval="$enable_decimal_float" + + case $enable_decimal_float in + yes | no | bid | dpd) ;; + *) { { echo "$as_me:$LINENO: error: '$enable_decimal_float' is an invalid value for --enable-decimal-float. +Valid choices are 'yes', 'bid', 'dpd', and 'no'." >&5 +echo "$as_me: error: '$enable_decimal_float' is an invalid value for --enable-decimal-float. +Valid choices are 'yes', 'bid', 'dpd', and 'no'." >&2;} + { (exit 1); exit 1; }; } ;; + esac + +else + + case $target in + powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux*) + enable_decimal_float=yes + ;; + *) + enable_decimal_float=no + ;; + esac + +fi; + +# x86's use BID format instead of DPD +if test x$enable_decimal_float = xyes; then + case $target in + i?86*-*-linux* | x86_64*-*-linux*) + enable_decimal_float=bid + ;; + *) + enable_decimal_float=dpd + ;; + esac +fi + + # Collect host-machine-specific information. . ${srcdir}/config.host @@ -4039,6 +4082,7 @@ s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@CPP@,$CPP,;t t s,@decimal_float@,$decimal_float,;t t +s,@enable_decimal_float@,$enable_decimal_float,;t t s,@vis_hide@,$vis_hide,;t t s,@tmake_file@,$tmake_file,;t t s,@extra_parts@,$extra_parts,;t t diff --git a/libgcc/configure.ac b/libgcc/configure.ac index 825805d..2e95e31 100644 --- a/libgcc/configure.ac +++ b/libgcc/configure.ac @@ -107,6 +107,42 @@ AC_CACHE_CHECK([whether decimal floating point is supported], [libgcc_cv_dfp], decimal_float=$libgcc_cv_dfp AC_SUBST(decimal_float) +AC_ARG_ENABLE(decimal-float, +[ --enable-decimal-float={no,yes,bid,dpd} + enable decimal float extension to C. Selecting 'bid' + or 'dpd' choses which decimal floating point format + to use], +[ + case $enable_decimal_float in + yes | no | bid | dpd) ;; + *) AC_MSG_ERROR(['$enable_decimal_float' is an invalid value for --enable-decimal-float. +Valid choices are 'yes', 'bid', 'dpd', and 'no'.]) ;; + esac +], +[ + case $target in + powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux*) + enable_decimal_float=yes + ;; + *) + enable_decimal_float=no + ;; + esac +]) + +# x86's use BID format instead of DPD +if test x$enable_decimal_float = xyes; then + case $target in + i?86*-*-linux* | x86_64*-*-linux*) + enable_decimal_float=bid + ;; + *) + enable_decimal_float=dpd + ;; + esac +fi +AC_SUBST(enable_decimal_float) + # Collect host-machine-specific information. . ${srcdir}/config.host |