2017q3 Homework(clz) === [github](https://github.com/hfming225/clz-tests) ## **開發環境** ### OS:ubuntu 16.04 LTS `$ lscpu` Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 8 On-line CPU(s) list: 0-7 Thread(s) per core: 2 Core(s) per socket: 4 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 94 Model name: Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz Stepping: 3 CPU MHz: 799.987 CPU max MHz: 4000.0000 CPU min MHz: 800.0000 BogoMIPS: 6816.00 Virtualization: VT-x L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 8192K NUMA node0 CPU(s): 0-7 ## 量測結果 * recursive version * 測試結果 ![](https://i.imgur.com/KmKGZq7.png) * iteration version * 測試結果 ![](https://i.imgur.com/IiptEbj.png) * binary search technique * 測試結果 binary search 在輸入接近10000時,會產生明顯抖動的現象發生! ![](https://i.imgur.com/nGVbkiR.png) * byte-shift version * 測試結果 ![](https://i.imgur.com/7OBCJra.png) * Harley’s algorithm * 測試結果 ![](https://i.imgur.com/N8nWGPJ.png) ## 測試結果比較 ![](https://i.imgur.com/JemYoOT.png) ## 參考資料 [gnu Makefile 使用手冊](https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html#Implicit-Variables) [gcc與Makefile使用筆記](http://jayextmemo.blogspot.tw/2015/01/linux-gcc-makefile.html)