Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts

Monday, November 02, 2009

BUG_ON(size & (size - 1));

今天看 Linux kernel 中 kfifo (circular buffer) 的 code, 無意間看到一行code


/* size must be a power of 2 */
BUG_ON(size & (size - 1));

這真是個好用的判断技巧

Friday, October 30, 2009

該來學學 scripting language 了

一直以來都在和 C/C++ 打交道,

所以趁現在有空檔就來學學 Lua吧,

多年前就知道這東西, 只是一直沒去研究它,

Lua 讓我印象最深刻的是 World of Warcraft 的 Add-ons 了

現在還特別出了本書 Beginning Lua with World of Warcraft Add-ons

或許真該買一本來看看, 雖然我好幾年沒玩 WoW 了

Lua 現今已被大量使用在各個 Online Game上

主要是因為 Lua 在眾多 scripting languages 中擁有最高的執行效率

會想研究 Lua 主要是因為 Lua 原始碼是 100% C 開發的, 看起來就很順眼, 哈哈