OnlineWoerterBuecher.de
Internes

Lexikon


Duff' s device


The most dramatic use yet seen of fall through in C, invented by Tom Duff when he was at Lucasfilm. Trying to bum all the instructions he could out of an inner loop that copied data serially onto an output port, he decided to unroll it. He then realised that the unrolled version could be implemented by *interlacing* the structures of a switch and a loop: 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 the first time, the device is actually perfectly valid, legal C. C' s default fall through in case statements has long been its most controversial single feature Duff observed that "This code forms some sort of argument in that debate, but I' m not sure whether it' s for or against." [For maximal obscurity, the outermost pair of braces above could be actually be removed - GLS] [Jargon File] (2001-06-22)

In addition suitable contents:
[ 2 ] [ = ] [ ag ] [ ai ] [ al ] [ am ] [ an ] [ app ] [ ar ] [ arc ] [ arg ] [ argument ] [ as ] [ at ] [ au ] [ b ] [ ba ] [ be ] [ bo ] [ br ] [ brace ] [ bs ] [ bum ] [ by ] [ C ] [ ca ] [ case ] [ case statement ] [ ch ] [ ci ] [ ck ] [ co ] [ code ] [ con ] [ cu ] [ D ] [ data ] [ de ] [ deb ] [ dec ] [ device ] [ do ] [ du ] [ ec ] [ ed ] [ ee ] [ eg ] [ er ] [ es ] [ et ] [ fall through ] [ fault ] [ feature ] [ fi ] [ file ] [ fo ] [ for ] [ forms ] [ fr ] [ G ] [ ga ] [ gh ] [ gi ] [ GL ] [ gl ] [ GLS ] [ gu ] [ h ] [ hat ] [ hr ] [ id ] [ ie ] [ il ] [ in ] [ int ] [ interlacing ] [ io ] [ ir ] [ is ] [ it ] [ J ] [ Jargon File ] [ ki ] [ la ] [ ld ] [ legal ] [ Lex ] [ li ] [ loop ] [ lt ] [ ly ] [ ma ] [ mo ] [ mod ] [ module ] [ mp ] [ ms ] [ na ] [ nc ] [ ne ] [ ng ] [ nn ] [ no ] [ nr ] [ ns ] [ om ] [ onto ] [ op ] [ output ] [ pa ] [ pe ] [ perf ] [ ph ] [ pl ] [ port ] [ query ] [ rc ] [ re ] [ real ] [ register ] [ rl ] [ ro ] [ ru ] [ S ] [ sc ] [ se ] [ serve ] [ si ] [ so ] [ sort ] [ st ] [ state ] [ struct ] [ su ] [ sum ] [ switch ] [ T ] [ tc ] [ th ] [ to ] [ tp ] [ tr ] [ ua ] [ ug ] [ um ] [ us ] [ va ] [ ve ] [ version ] [ vi ] [ while ] [ ye ]






Go Back ]

Free On-line Dictionary of Computing

Copyright © by OnlineWoerterBuecher.de - (5465 Reads)

All logos and trademarks in this site are property of their respective owner.

Page Generation in 0.0966 Seconds, with 18 Database-Queries
Zurück zur Startseite