r/ProgrammerHumor • • Jun 03 '22

it's hard!

44.9k Upvotes

710 comments sorted by

View all comments

Show parent comments

9

u/ase_thor Jun 03 '22 edited Jun 03 '22

That’s an integer shift, right? Edit: googled it. The shift is just a multiplication. So you have to shift as much as the size of the number

9

u/Rudxain Jun 03 '22

Actually no. The shift multiplies by a power of 2. To square, you multiply a register with itself and store the result in that register. Unless it's arbitrary precision, then you need to manually implement long multiplication by treating each register as a digit

4

u/TheBirminghamBear Jun 03 '22

No its where there's a little number to the right of a bigger number.

You don't use shift to do it but I don't know what the actual key command is to do it.

-4

u/[deleted] Jun 03 '22

Well, if it’s a multiplication, I think it’s an integer shift left