in reply to Re: Converting an array of bytes into a BigInt - 1500% quicker.
in thread Converting an array of bytes into a BigInt - speed considerations


Nice. ++

Dealing with the data in terms of 4-byte longs reduces the operations by 75%, which, I guess, gives the four fold speed-up.*

Who says it looks unreadable. ;-) The (4 - ( @_%4 || 4 )) part looked familiar. I had to do something like that a while ago to pad chars to a 4-byte boundary. In terms of your notation this is what I came up with:

((4 - @_%4)%4)

Update: *Reading back I see that bart spotted this exploit earlier.

--
John.

  • Comment on Re: Re: Converting an array of bytes into a BigInt - 1500% quicker.
  • Download Code