How does Duff’s device work?

There are some good explanations elsewhere, but let me give it a try. (This is a lot easier on a whiteboard!) Here’s the Wikipedia example with some notations. Let’s say you’re copying 20 bytes. The flow control of the program for the first pass is: int count; // Set to 20 { int n = … Read more