General fix for alignment issues on ARM

and alloc big arrays on heap instead of stack, to prevent overflow on small stack
Merge pull request #1 from mesailde/master

General fix for alignment issues on ARM