print int as ascii in assembly 64 bit at&t float number error

后端 未结 1 532
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-28 08:18

I\'ve written a solo program just to figure out how to do this, earlier I added 48 to the number to print but now when I get numbers larger than 9 it\'s not really sufficient an

1条回答
  •  隐瞒了意图╮
    2021-01-28 08:38

    When you do divq %r11 you're actually dividing the 128-bit register pair rdx:rax by r11. So to get a quotient that will fit in rax you'll typically want to clear rdx before the division, i.e. before the divq, add an:

    xorq %rdx, %rdx   # rdx = 0
    

    0 讨论(0)
提交回复
热议问题