Thread View: comp.sys.sun
1 messages
1 total messages
Started by Peter Kuterna
Fri, 29 Jan 1999 00:00
Floating point to integer (inline assembly)
Author: Peter Kuterna
Date: Fri, 29 Jan 1999 00:00
Date: Fri, 29 Jan 1999 00:00
25 lines
1522 bytes
1522 bytes
We have in program in C that performs a test of the floating point
hardware.
Because of the C standard, the conversion from floating point to
integer is truncated. But we need to test this in the four available
rounding modes. For the i386-version of the program, I was able to
find some code with inline assembly that online performs the
conversion, and doesn't set the rounding mode to zero. The code is as
follows:
static inline int RoundToInt(double d) {
int i;
asm ("fistpl %0" : "=m" (i) : "t" (d) : "%st");
return i;
}
But I'm not able to generate assembly code for the Sparc-version of
the program. Is there someone who can help me out with this?
We use gcc 2.8.1 on our system.
Thanks in advance,
Peter.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads