Mail Archives: djgpp/1996/08/29/07:25:59
Xref: | news2.mv.net comp.os.msdos.djgpp:8008
|
From: | cowley AT crab DOT rutgers DOT edu (Roger Cowley)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Using inline as to multiply two fixed point #'s
|
Date: | 28 Aug 1996 16:47:19 -0400
|
Organization: | Rutgers University
|
Lines: | 31
|
Message-ID: | <502b8n$eh6@crab.rutgers.edu>
|
NNTP-Posting-Host: | crab.rutgers.edu
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Allright, so I need functions to multiply and divide fixed point
numbers, but I'm having problems with djgpp and inline assembly.
fixed is just typedef long fixed
say x,y, and z are all fixed
x = (fixed)(65536 * 2.3);
y = (fixed)(65536 * 3.2);
asm("
mov _x,%eax
imul _y
mov %eax,_z
");
Now, there are of course complications. Yes I made x,y,and z global
so the inline assembler could use them. But here's where I get
tripped up: a long times a long is 64 bit...so this is a 32-bit
expanding multiply whose result is 64-bit, right? How do I use the
imul instruction correctly in this case, and how do I dump my result
into z?
It would be great if any replies where both posted and replies.
Any help would be greatly appreciated.
Sorry if there are some stupid mistakes in the above code, I forgot to
write down what I was working on.
Tony
- Raw text -