int_to_bytes

new topic     » topic index » view thread      » older message » newer message

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

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu