mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-22 15:23:48 +01:00
Binary float writing: Improve performance
This commit is contained in:
parent
5efc048887
commit
209fb06d6d
@ -122,13 +122,13 @@ function write_float(write_byte, number, on_write, double)
|
||||
on_write(double)
|
||||
end
|
||||
local len = double and 6 or 2
|
||||
for index = len, 1, -1 do
|
||||
for index = 1, len do
|
||||
mantissa = mantissa * 0x100
|
||||
mantissa_bytes[index] = math_floor(mantissa)
|
||||
mantissa = mantissa % 1
|
||||
end
|
||||
assert(mantissa == 0)
|
||||
for index = 1, len do
|
||||
for index = len, 1, -1 do
|
||||
write_byte(mantissa_bytes[index])
|
||||
end
|
||||
write_byte(exponent_byte)
|
||||
|
Loading…
Reference in New Issue
Block a user