Replace `ceil(log(..., 2))` with `frexp`
Lua 5.1 does not support passing a base; it would use the natural logarithm, thus the values would be slightly off.
Notes:
- Found with https://gist.github.com/appgurueu/21132254211f32fb210c429cf56c4b2b
- Untested
- Alternative would be continuing using
math.logbut dividing bymath.log(2)(basis transformation);frexpis IMO more readable and probably more efficient (though probably negligibly so) - use whichever you consider more readable
Edited by Lars Müller