[math-fun] Unusual ways to count thru all w-bit numbers
To FWL: "Unidirectional" info flow implies that the low-signif bits of x, have tiny periods, namely the (<=K)th bits have period <=2^(K-1). This behavior is just like the boring repeated-increment counter. If you want to avoid that boredom, you need bidirectionality. Incidentally, another counter for word length W=16 is x=0; do{ x = (x+1)*75 mod (2^16+1) - 1; }until(x=0); The sorts of "bidirectional bit flow" counters I described before are quite fast, but unfortunately rather expensive to find. (They are fast once found.) In fact the only ways I know to find them take about 4^W operations (heuristically). To DW: Thank you for proving C++ sucks beyond belief and it NOT, contrary to propaganda, a superset of plain C. And, as a followup question, can C++ tell you whether there was an overflow?
participants (1)
-
Warren D Smith