Hmm. Doesn't make full sense to me this way.
First part of your explanation is OK - let's say we need to unroll a loop for efficiency. And we decide to unroll it so it has 8 statements inside the loop. So, assuming count>0, we would do something like this (using dots to show indentation because "ecode" eats up leading spaces):
void copy(char *from, char *to, int count) {
..int n = count / 8;
..int i;
..if (n > 0) {
....do {
......*from++ = *to++;
....../* 7 more times (code omitted to avoid slashdot lameness filter) */
....} while(--n > 0);
..}
../* Handle the "leftovers" */
..for (i=0; i<n%8; ++i) {
....*from++ = *to++;
..}
}
That's a standard loop-unrolling for you. Duff's Device just shortens it. How? The switch statement jumps into the loop to a point where we first handle the "leftovers", and then we execute the loop (count/8) times, each time copying 8 elements, thus copying (count/8)*8 elements in the loop (which, because of integer division is not equal to count unless count%8==0, that's why the leftovers).
Thus, the part where you talk about count being excatly divisible by 5, 6, 7, etc., is wrong. The switch statement only checks the remainder of count when divided by 8.
This may be wrong too. In that case, please feel free to correct me.