| 1780 | } |
| 1781 | |
| 1782 | WARN_UNUSED_RESULT |
| 1783 | static int rfftp_factorize (rfftp_plan plan) |
| 1784 | { |
| 1785 | size_t length=plan->length; |
| 1786 | size_t nfct=0; |
| 1787 | while ((length%4)==0) |
| 1788 | { if (nfct>=NFCT) return -1; plan->fct[nfct++].fct=4; length>>=2; } |
| 1789 | if ((length%2)==0) |
| 1790 | { |
| 1791 | length>>=1; |
| 1792 | // factor 2 should be at the front of the factor list |
| 1793 | if (nfct>=NFCT) return -1; |
| 1794 | plan->fct[nfct++].fct=2; |
| 1795 | SWAP(plan->fct[0].fct, plan->fct[nfct-1].fct,size_t); |
| 1796 | } |
| 1797 | size_t maxl=(size_t)(sqrt((double)length))+1; |
| 1798 | for (size_t divisor=3; (length>1)&&(divisor<maxl); divisor+=2) |
| 1799 | if ((length%divisor)==0) |
| 1800 | { |
| 1801 | while ((length%divisor)==0) |
| 1802 | { |
| 1803 | if (nfct>=NFCT) return -1; |
| 1804 | plan->fct[nfct++].fct=divisor; |
| 1805 | length/=divisor; |
| 1806 | } |
| 1807 | maxl=(size_t)(sqrt((double)length))+1; |
| 1808 | } |
| 1809 | if (length>1) plan->fct[nfct++].fct=length; |
| 1810 | plan->nfct=nfct; |
| 1811 | return 0; |
| 1812 | } |
| 1813 | |
| 1814 | static size_t rfftp_twsize(rfftp_plan plan) |
| 1815 | { |
no test coverage detected