int_to_bytes
- Posted by a.tammer at hetnet.nl Mar 18, 2002
- 366 views
Hi Robert, After changing your int_to_bytes in the following fashion I clocked a 20% time-reduction on my standard 1e8 loops. As you see I only operate on an atom twice, use the faster and_bits and save a line of code. It's up to you to implement it in the machine.e-lib I think as it ruins the stamp. function int_to_bytes(atom x) integer a,b,c,d a = remainder(x , #10000) c = floor(x / #10000) b = floor(a / #100) a = and_bits(a, #FF) d = floor(c / #100) c = and_bits(c , #FF) return{a,b,c,d} end function Regards, Antoine