1 /* Copyright (C) 2007-2015 Free Software Foundation, Inc.
3 This file is part of GCC.
5 GCC is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free
7 Software Foundation; either version 3, or (at your option) any later
10 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 Under Section 7 of GPL version 3, you are granted additional
16 permissions described in the GCC Runtime Library Exception, version
17 3.1, as published by the Free Software Foundation.
19 You should have received a copy of the GNU General Public License and
20 a copy of the GCC Runtime Library Exception along with this program;
21 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
22 <http://www.gnu.org/licenses/>. */
24 #include "bid_internal.h"
26 // convert_table[j][k][i] = digit i (base 10^8) of k*2^(26+7*j)
27 const UINT32 convert_table
[5][128][2] = {
451 , {58127616, 1000555}
452 , {69755392, 1011550}
453 , {81383168, 1022545}
454 , {93010944, 1033540}
457 , {16266496, 1055531}
458 , {27894272, 1066526}
459 , {39522048, 1077521}
460 , {51149824, 1088516}
463 , {74405376, 1110506}
464 , {86033152, 1121501}
465 , {97660928, 1132496}
469 , {32544256, 1165482}
470 , {44172032, 1176477}
471 , {55799808, 1187472}
472 , {67427584, 1198467}
475 , {90683136, 1220457}
477 , {13938688, 1242448}
478 , {25566464, 1253443}
481 , {48822016, 1275433}
482 , {60449792, 1286428}
483 , {72077568, 1297423}
484 , {83705344, 1308418}
488 , {18588672, 1341404}
489 , {30216448, 1352399}
490 , {41844224, 1363394}
493 , {65099776, 1385384}
494 , {76727552, 1396379}
500 , {88355328, 1407374}
501 , {76710656, 2814749}
502 , {65065984, 4222124}
503 , {53421312, 5629499}
506 , {30131968, 8444249}
507 , {18487296, 9851624}
508 , {6842624, 11258999}
509 , {95197952, 12666373}
512 , {71908608, 15481123}
513 , {60263936, 16888498}
514 , {48619264, 18295873}
515 , {36974592, 19703248}
518 , {13685248, 22517998}
519 , {2040576, 23925373}
520 , {90395904, 25332747}
521 , {78751232, 26740122}
524 , {55461888, 29554872}
525 , {43817216, 30962247}
526 , {32172544, 32369622}
527 , {20527872, 33776997}
530 , {97238528, 36591746}
531 , {85593856, 37999121}
532 , {73949184, 39406496}
533 , {62304512, 40813871}
536 , {39015168, 43628621}
537 , {27370496, 45035996}
538 , {15725824, 46443371}
539 , {4081152, 47850746}
542 , {80791808, 50665495}
543 , {69147136, 52072870}
544 , {57502464, 53480245}
545 , {45857792, 54887620}
548 , {22568448, 57702370}
549 , {10923776, 59109745}
550 , {99279104, 60517119}
551 , {87634432, 61924494}
554 , {64345088, 64739244}
555 , {52700416, 66146619}
556 , {41055744, 67553994}
557 , {29411072, 68961369}
560 , {6121728, 71776119}
561 , {94477056, 73183493}
562 , {82832384, 74590868}
563 , {71187712, 75998243}
566 , {47898368, 78812993}
567 , {36253696, 80220368}
568 , {24609024, 81627743}
569 , {12964352, 83035118}
572 , {89675008, 85849867}
573 , {78030336, 87257242}
574 , {66385664, 88664617}
575 , {54740992, 90071992}
578 , {31451648, 92886742}
579 , {19806976, 94294117}
580 , {8162304, 95701492}
581 , {96517632, 97108866}
584 , {73228288, 99923616}
585 , {61583616, 1330991}
586 , {49938944, 2738366}
587 , {38294272, 4145741}
590 , {15004928, 6960491}
592 , {91715584, 9775240}
593 , {80070912, 11182615}
596 , {56781568, 13997365}
597 , {45136896, 15404740}
598 , {33492224, 16812115}
599 , {21847552, 18219490}
602 , {98558208, 21034239}
603 , {86913536, 22441614}
604 , {75268864, 23848989}
605 , {63624192, 25256364}
608 , {40334848, 28071114}
609 , {28690176, 29478489}
610 , {17045504, 30885864}
611 , {5400832, 32293239}
614 , {82111488, 35107988}
615 , {70466816, 36515363}
616 , {58822144, 37922738}
617 , {47177472, 39330113}
620 , {23888128, 42144863}
621 , {12243456, 43552238}
623 , {88954112, 46366987}
626 , {65664768, 49181737}
627 , {54020096, 50589112}
628 , {42375424, 51996487}
629 , {30730752, 53403862}
632 , {7441408, 56218612}
633 , {95796736, 57625986}
634 , {84152064, 59033361}
635 , {72507392, 60440736}
638 , {49218048, 63255486}
639 , {37573376, 64662861}
640 , {25928704, 66070236}
641 , {14284032, 67477611}
644 , {90994688, 70292360}
645 , {79350016, 71699735}
646 , {67705344, 73107110}
647 , {56060672, 74514485}
650 , {32771328, 77329235}
651 , {21126656, 78736610}
657 , {9481984, 80143985}
658 , {18963968, 60287970}
659 , {28445952, 40431955}
660 , {37927936, 20575940}
663 , {56891904, 80863910}
664 , {66373888, 61007895}
665 , {75855872, 41151880}
666 , {85337856, 21295865}
669 , {4301824, 81583836}
670 , {13783808, 61727821}
671 , {23265792, 41871806}
672 , {32747776, 22015791}
675 , {51711744, 82303761}
676 , {61193728, 62447746}
677 , {70675712, 42591731}
678 , {80157696, 22735716}
681 , {99121664, 83023686}
682 , {8603648, 63167672}
683 , {18085632, 43311657}
684 , {27567616, 23455642}
687 , {46531584, 83743612}
688 , {56013568, 63887597}
689 , {65495552, 44031582}
690 , {74977536, 24175567}
693 , {93941504, 84463537}
694 , {3423488, 64607523}
695 , {12905472, 44751508}
696 , {22387456, 24895493}
699 , {41351424, 85183463}
700 , {50833408, 65327448}
701 , {60315392, 45471433}
702 , {69797376, 25615418}
705 , {88761344, 85903388}
706 , {98243328, 66047373}
707 , {7725312, 46191359}
708 , {17207296, 26335344}
711 , {36171264, 86623314}
712 , {45653248, 66767299}
713 , {55135232, 46911284}
714 , {64617216, 27055269}
717 , {83581184, 87343239}
718 , {93063168, 67487224}
719 , {2545152, 47631210}
720 , {12027136, 27775195}
723 , {30991104, 88063165}
724 , {40473088, 68207150}
725 , {49955072, 48351135}
726 , {59437056, 28495120}
729 , {78401024, 88783090}
730 , {87883008, 68927075}
731 , {97364992, 49071060}
732 , {6846976, 29215046}
735 , {25810944, 89503016}
736 , {35292928, 69647001}
737 , {44774912, 49790986}
738 , {54256896, 29934971}
741 , {73220864, 90222941}
742 , {82702848, 70366926}
743 , {92184832, 50510911}
744 , {1666816, 30654897}
747 , {20630784, 90942867}
748 , {30112768, 71086852}
749 , {39594752, 51230837}
750 , {49076736, 31374822}
753 , {68040704, 91662792}
754 , {77522688, 71806777}
755 , {87004672, 51950762}
756 , {96486656, 32094747}
759 , {15450624, 92382718}
760 , {24932608, 72526703}
761 , {34414592, 52670688}
762 , {43896576, 32814673}
765 , {62860544, 93102643}
766 , {72342528, 73246628}
767 , {81824512, 53390613}
768 , {91306496, 33534598}
771 , {10270464, 93822569}
772 , {19752448, 73966554}
773 , {29234432, 54110539}
774 , {38716416, 34254524}
777 , {57680384, 94542494}
778 , {67162368, 74686479}
779 , {76644352, 54830464}
780 , {86126336, 34974449}
783 , {5090304, 95262420}
784 , {14572288, 75406405}
785 , {24054272, 55550390}
786 , {33536256, 35694375}
789 , {52500224, 95982345}
790 , {61982208, 76126330}
791 , {71464192, 56270315}
792 , {80946176, 36414300}
795 , {99910144, 96702270}
796 , {9392128, 76846256}
797 , {18874112, 56990241}
798 , {28356096, 37134226}
801 , {47320064, 97422196}
802 , {56802048, 77566181}
803 , {66284032, 57710166}
804 , {75766016, 37854151}
807 , {94729984, 98142121}
808 , {4211968, 78286107}
814 // for j>=min_j[i+1], there is k s.t. convert_table[i][j][k]>0
815 // int min_j[] = { 0, 0, 0, 3 };
817 // for even k, ((packed_10000_zeros[k>>3])>>(k&7))&3)=greatest(i) s.t. 10^i divides k
818 const UINT8 packed_10000_zeros
[] = {
820 0x3, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x20,
822 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x2, 0x4, 0x10, 0x40,
824 0x10, 0x40, 0x0, 0x1, 0x4, 0x20, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0,
826 0x40, 0x0, 0x2, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1,
828 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x2, 0x4,
830 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x20, 0x40, 0x0, 0x1, 0x4, 0x10,
832 0x4, 0x10, 0x40, 0x0, 0x2, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40,
834 0x20, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0,
836 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x20, 0x40, 0x0, 0x1,
838 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x2, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4,
840 0x1, 0x4, 0x20, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10,
842 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x20, 0x40,
844 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x2, 0x4, 0x10, 0x40, 0x0,
846 0x40, 0x0, 0x1, 0x4, 0x20, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1,
848 0x0, 0x2, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4,
850 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x3, 0x4, 0x10,
852 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x20, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40,
854 0x10, 0x40, 0x0, 0x2, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0,
856 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x2,
858 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x20, 0x40, 0x0, 0x1, 0x4,
860 0x1, 0x4, 0x10, 0x40, 0x0, 0x2, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10,
862 0x4, 0x20, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40,
864 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x20, 0x40, 0x0,
866 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x3, 0x4, 0x10, 0x40, 0x0, 0x1,
868 0x0, 0x1, 0x4, 0x20, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4,
870 0x2, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x20,
872 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x2, 0x4, 0x10, 0x40,
874 0x10, 0x40, 0x0, 0x1, 0x4, 0x20, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0,
876 0x40, 0x0, 0x2, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1,
878 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x2, 0x4,
880 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x20, 0x40, 0x0, 0x1, 0x4, 0x10,
882 0x4, 0x10, 0x40, 0x0, 0x3, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40,
884 0x20, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0,
886 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x20, 0x40, 0x0, 0x1,
888 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x2, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4,
890 0x1, 0x4, 0x20, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10,
892 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x20, 0x40,
894 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x2, 0x4, 0x10, 0x40, 0x0,
896 0x40, 0x0, 0x1, 0x4, 0x20, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1,
898 0x0, 0x3, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4,
900 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x2, 0x4, 0x10,
902 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x20, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40,
904 0x10, 0x40, 0x0, 0x2, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0,
906 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x2,
908 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x20, 0x40, 0x0, 0x1, 0x4,
910 0x1, 0x4, 0x10, 0x40, 0x0, 0x2, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10,
912 0x4, 0x20, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40,
914 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x20, 0x40, 0x0,
916 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x2, 0x4, 0x10, 0x40, 0x0, 0x1,
918 0x0, 0x1, 0x4, 0x20, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4,
920 0x2, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x20,
922 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x2, 0x4, 0x10, 0x40,
924 0x10, 0x40, 0x0, 0x1, 0x4, 0x20, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0,
926 0x40, 0x0, 0x2, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1,
928 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x3, 0x4,
930 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x20, 0x40, 0x0, 0x1, 0x4, 0x10,
932 0x4, 0x10, 0x40, 0x0, 0x2, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40,
934 0x20, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0,
936 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x20, 0x40, 0x0, 0x1,
938 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x2, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4,
940 0x1, 0x4, 0x20, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10,
942 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x20, 0x40,
944 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x3, 0x4, 0x10, 0x40, 0x0,
946 0x40, 0x0, 0x1, 0x4, 0x20, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1,
948 0x0, 0x2, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4,
950 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x2, 0x4, 0x10,
952 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x20, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40,
954 0x10, 0x40, 0x0, 0x2, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0,
956 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x2,
958 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x20, 0x40, 0x0, 0x1, 0x4,
960 0x1, 0x4, 0x10, 0x40, 0x0, 0x3, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10,
962 0x4, 0x20, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40,
964 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x20, 0x40, 0x0,
966 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x2, 0x4, 0x10, 0x40, 0x0, 0x1,
968 0x0, 0x1, 0x4, 0x20, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4,
970 0x2, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x20,
972 0x4, 0x10, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0, 0x2, 0x4, 0x10, 0x40,
974 0x10, 0x40, 0x0, 0x1, 0x4, 0x20, 0x40, 0x0, 0x1, 0x4, 0x10, 0x40, 0x0,
980 const SINT8 factors
[1024][2] = {