flat assembler
Message board for the users of flat assembler.
  
|  Index
      > Windows > [SOLVED] Division With Negative Numbers | 
| Author | 
 | 
| LocoDelAssembly 16 Feb 2012, 16:31 Use idiv instruction.
 [edit]And cdq instead of "xor edx, edx" | |||
|  16 Feb 2012, 16:31 | 
 | 
| Apos 16 Feb 2012, 16:35 That was fast!
 Very interesting. I'll have to look into cdq, it looks like idiv doesn't give the right result without it. | |||
|  16 Feb 2012, 16:35 | 
 | 
| AsmGuru62 16 Feb 2012, 17:33 IDIV works with EDX:EAX and you set EDX to zero - EDX must have sign extended over all its bits.
 CDQ does just that - it takes the bit sign from EAX (bit #31) and sets all bits in EDX to that bit value. | |||
|  16 Feb 2012, 17:33 | 
 | 
| rugxulo 16 Feb 2012, 21:39 | |||
|  16 Feb 2012, 21:39 | 
 | 
| < Last Thread | Next Thread > | 
| Forum Rules: 
 | 
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.