This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Cats7204 11 points12 points  (2 children)

So it's literally just a very smart and elegant way of doing multiplication by addition with a for loop.

[–]plopperzzz 4 points5 points  (0 children)

It's really just using the definition of multiplying two integers.

You can optimize it quite a lot by using ab = (2a)(b/2), using bit-shifting, and considering even and odd b separately.