【转】Duff's Device
摘要:
在看strcpy、memcpy等的实现发现用了内存对齐,每一个word拷贝一次的办法大大提高了实现效率,参加该blog(http://totoxian.iteye.com/blog/1220273)。duff's device也是利用了类似的原理减少比较的次数来提高了效率。前几天在网上看见了一段代码,叫做“Duff's Device”,后经验证它曾出现在Bjarne的TC++PL里面:void send( int * to, int * from, int count) // Duff设施,有帮助的注释被有意删去了{ int n = (count + 7 ) / 8 ; swi 阅读全文
posted @ 2013-07-22 19:59
lonelycloud
阅读(152)
评论(0)
推荐(0)
浙公网安备 33010602011771号