星期五, 7月 15, 2005

[C/C++]Duff’s Device

國二菜鳥忙裡偷閒看到這篇Duff’s Device.

這段 code, 真的很神奇
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);
}


不過我必須承認,在看了它提供的參考網址以後,我不知道這段 code 在幹麼....

參考網址:

沒有留言: