10-28-2015, 07:48 PM
I think this would be much better suited as a C++ implementation exported to Lua. It's far easier to do that bit twiddling in C++. To be honest, I'd have no idea how to read and write floats and doubles in Lua only, considering that the Lua's number type can internally be an integer, float or double, based on compile-time settings.