Duff’s device is a really neat construct for unrolling loops of indeterminate size. It was invented by Tom Duff during the early eighties (Duff's account) as a highly efficient way of copying memory, but can be used for other things too.
Basical ...
Read post