\dˈʌfs dɪvˈa͡ɪs], \dˈʌfs dɪvˈaɪs], \d_ˈʌ_f_s d_ɪ_v_ˈaɪ_s]\
Definitions of DUFF'S DEVICE
Sort: Oldest first
The most dramatic use yet seen of fall through in C,invented by Tom Duff when he was at Lucasfilm. Trying tobum all the instructions he could out of an inner loop thatcopied data serially onto an output port, he decided to unrollit. He then realised that the unrolled version could beimplemented by *interlacing* the structures of a switch and aloop: register n = (count + 7) / 8; /* count > 0 assumed */ switch (count % 8) case 0: do *to = *from++; case 7: *to = *from++; case 6: *to = *from++; case 5: *to = *from++; case 4: *to = *from++; case 3: *to = *from++; case 2: *to = *from++; case 1: *to = *from++; while (--n > 0); Shocking though it appears to all who encounter it for thefirst time, the device is actually perfectly valid, legal C.C's default fall through in case statements has long beenits most controversial single feature; Duff observed that"This code forms some sort of argument in that debate, but I'mnot sure whether it's for or against."[For maximal obscurity, the outermost pair of braces abovecould be actually be removed - GLS]
By Denis Howe
Word of the day
- a threadlike extension of nerve cell Slender processes of neurons, especially the prolonged axons that conduct nerve impulses. One units trunk; it is axis process a neuron and medullated, i. e. white substance Schwann (myelin), medullated; either the medullated non-axis-cylinder or may not be surrounded by primitive sheath neurilemma, so that there are four forms of nerve-fibers.