Fix ATI problems with Chrome v39 Beta

Non-constant array access causes problems with Chrome v39 Beta. I've solved the problem by loop unrolling.
Merge pull request #308 from clementlevasseur/patch-1

Fix ATI problems with Chrome v39 Beta