#include <crt_int.hpp>
Definition at line 195 of file crt_int.hpp.
Definition at line 209 of file crt_int.hpp.
References mmx::C, mmx::is_prime(), M, mmx::N(), and mmx::value().
00209 { 00210 // construct prime moduli of s bits exactly, 00211 // starting with those which have a maximal number of 00212 // primitive 2^k-th roots of unity 00213 typedef modulus<C,V> M; 00214 const nat b= V::template maximum_size_helper<C>::value; 00215 ASSERT (s <= b, "bitsize overflow"); 00216 ASSERT (b <= 8 * sizeof (nat), "bitsize overflow"); 00217 if (s < 2 && n > 0) return false; 00218 const C m= 1 + MMX_SAFE_LEFT_SHIFT_INT (C, 1, (s-1)); 00219 const C l= MMX_SAFE_LEFT_SHIFT_INT (C, 1, s); 00220 for (nat i= N(v); i < n; i++) { 00221 C j= i == 0 ? m : (bit_reverse (* v[i-1], s) + 2), k; 00222 for (; j <= l - 1 && j >= m; j += 2) 00223 if (is_prime (k= bit_reverse (j, s))) break; 00224 if (j > l - 1 || j < m) return false; 00225 v << M(k); } 00226 return true; }