3 ms·
That's really a strange question to ask, a bit like: "What is the largest integer you know?" You can start with a reversible gate (such as https://en.wikipedia
by js8 9y ago
That's really a strange question to ask, a bit like: "What is the largest integer you know?"
You can start with a reversible gate (such as https://en.wikipedia.org/wiki/Toffoli_gate https://en.wikipedia.org/wiki/Toffoli_gate or https://en.wikipedia.org/wiki/Fredkin_gate https://en.wikipedia.org/wiki/Fredkin_gate) and combine these.
- jws 9y agoNot explicit in the title is “efficiently on a modern CPU”. They tend to be 1 to 4 opcodes each. I think the list might serve as a jumping off point if you are looking at an algorithm which depends on an integer permutation and want to consider how it would change if you used a different permutation. And missing from the list—the identity function! Very fast to compute and universally (not)implemented on all CPUs.
- haimez 9y agoThe identity function is not an interesting opcode because there's already the NOOP code and because compilers are expected to be able to identify the identity transform with great accuracy.