2 ms·
No, he is refering to the fact that the original Duff's device contains: *to = *from++ Note that there isn't a '++' on 'to'. Make people think that Duff's
by CJefferson 14y ago
No, he is refering to the fact that the original Duff's device contains:
*to = *from++
Note that there isn't a '++' on 'to'. Make people think that Duff's device is for making a fast memcpy (which you would get with to++ = from++), but in fact it was for copying data to a MMR.
Nowadays, most of the loop would be optimised away by the compiler, unless you marked to as volatile. Assuming you mark to as volatile, this kind of code is still used to write the MMR, although they are much less used than they used to be. The last time I wrote code anything like this was on the Nintendo Gameboy Advance. I don't know if the DS / 3DS still use similar code.