Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdint.h>
- #include <iomanip>
- void checkAllAdlers(uint32_t sofar, int depth, uint32_t a, uint32_t b) {
- int modulus = 65521;
- if (depth == 4) {
- if ((b << 16) + a == sofar) {
- std::cout << "Got a fixed point: 0x" <<
- std::hex << std::setw(8) << std::setfill('0') <<
- sofar << "\n";
- }
- return;
- }
- for (uint32_t i = 0; i < 256; ++i) {
- uint32_t newa = a + i;
- if (newa >= modulus) newa -= modulus;
- uint32_t newb = b + a;
- if (newb >= modulus) newb -= modulus;
- checkAllAdlers(sofar + (i << (depth*8)), depth + 1, newa, newb);
- }
- return;
- }
- int main() {
- put("abc");
- system("pause");
- checkAllAdlers(0, 0, 2, 0);
- }
Advertisement
Add Comment
Please, Sign In to add comment