How to write such code in C:
Temporary = AX / Source; //signed division
AL = Temporary;
AH = AX % Source; //signed modulus
I get ax, al, ah values which is by default unsigned, to perform signed divide i just need to convert them to signed and that's all ?
Signed division in C
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Signed division in C
since when would dividing signed numbers be done with an unsigned division?
Re: Signed division in C
I don't understand your question?. I'm need to implement div and idiv instructions, but i don't see difference.
I found page: http://www.ragestorm.net/blogs/?p=62 it's talking about. Says to signed divide i need to do:
res = x/y; if (sign_of_x != sign_of_y) res = -res; (need do this in python)
Does this same in C ?
I found page: http://www.ragestorm.net/blogs/?p=62 it's talking about. Says to signed divide i need to do:
res = x/y; if (sign_of_x != sign_of_y) res = -res; (need do this in python)
Does this same in C ?
Re: Signed division in C
You need to write division in C? It might help if you told us a bit more about the requirements/restrictions. Otherwise I'd just say, why bother? Just use C's built in division.