Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //in : sieveNum, steps
- //out : return value, a, b
- uint32_t getCoefficientsAndOddOccurrence(const mp::cpp_int& sieveNum, const uint32_t steps, mp::cpp_int& a, mp::cpp_int& b)
- {
- uint32_t odds = 0;
- a = mp::cpp_int(1u) << steps;
- b = sieveNum;
- for (uint32_t i = 0; i < steps; ++i)
- {
- if (static_cast<uint32_t>(b)& 1u)
- {
- a += a >> 1;
- b += (b + 1) >> 1;
- ++odds;
- }
- else
- {
- a >>= 1;
- b >>= 1;
- }
- } //for()
- return odds;
- }//getCoefficientsAndOddOccurrence()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement