Mail Archives: djgpp/1998/02/19/00:01:11
chris doty <orz AT wpi DOT edu> wrote:
: > I just want to know, how I can change a number, which is negative, to
: > positive,
: > and in asm. I bet it can be done, but how?
: > I've got an almost ready cool demo-effect, but when I add two numbers
: > together,
: > the other one is negative, and I can't do anything about it.
: x86s have hardware support for flipping the sign. I believe mnemonic is
: NEG. This is equivelent to a NOT followed by an INC.
Just a note that in one GAS (GNU assembler) program, I used fabs to obtain
the absolute value of a floating-point number. However, I'm not sure if
this program uses floating-point values, and I guess that integer math, if
adequate, might be faster <grin>.
Most respectfully,
Margo Schulter
mschulter AT value DOT net
- Raw text -