| 964 | |
| 965 | NOINLINE WARN_UNUSED_RESULT |
| 966 | static int cfftp_factorize (cfftp_plan plan) |
| 967 | { |
| 968 | size_t length=plan->length; |
| 969 | size_t nfct=0; |
| 970 | while ((length%4)==0) |
| 971 | { if (nfct>=NFCT) return -1; plan->fct[nfct++].fct=4; length>>=2; } |
| 972 | if ((length%2)==0) |
| 973 | { |
| 974 | length>>=1; |
| 975 | // factor 2 should be at the front of the factor list |
| 976 | if (nfct>=NFCT) return -1; |
| 977 | plan->fct[nfct++].fct=2; |
| 978 | SWAP(plan->fct[0].fct, plan->fct[nfct-1].fct,size_t); |
| 979 | } |
| 980 | size_t maxl=(size_t)(sqrt((double)length))+1; |
| 981 | for (size_t divisor=3; (length>1)&&(divisor<maxl); divisor+=2) |
| 982 | if ((length%divisor)==0) |
| 983 | { |
| 984 | while ((length%divisor)==0) |
| 985 | { |
| 986 | if (nfct>=NFCT) return -1; |
| 987 | plan->fct[nfct++].fct=divisor; |
| 988 | length/=divisor; |
| 989 | } |
| 990 | maxl=(size_t)(sqrt((double)length))+1; |
| 991 | } |
| 992 | if (length>1) plan->fct[nfct++].fct=length; |
| 993 | plan->nfct=nfct; |
| 994 | return 0; |
| 995 | } |
| 996 | |
| 997 | NOINLINE static size_t cfftp_twsize (cfftp_plan plan) |
| 998 | { |
no test coverage detected