c - Does Duff's Device work in other languages? -


Many years ago working on a tight graphics I / O problem, Tom Duff opened a loop and made it as follows:

/ P>

  dsend (from, to, count) from four *, * to; integer number; {Int n = (count +7) / 8; Switch (count% 8) {case 0: do {* to = * to ++; Case 7: * to = * to ++; Case 6: * to = * to ++; Case 5: * to = * to ++; Case 4: * to = * to ++; Case 3: * to = * to ++; Case 2: * to = * to ++; Case 1: * to = * to ++; } While (-n & gt; 0); }}  

(Note that this uses the old style function parameter - this is not an error.)

This coding modeled in coding and coding in C. Comes directly to C depending on the basis of the statement. Can such creativity work in control structures in any other languages?

You can do it in any way that language supports mathematical statements (Fortran, Some basic, etc.)


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -