Refactor the Javascript code.

* Isolate the internal variables so that the code acts like a module and doesn't pollute the global namespace
* Add tests (which can be run via pack64.test())
* Return Float32Arrays rather than Javascript arrays for performance.