History

add declaration of the "double trunc (double _x)" and winsock2.h This allow to build a windows version of the nimrod compiler.

seyko committed 11 years ago

Commit 351e2ec1 parent 4b61f7f1 file · +21 −0Browse files

Unified · Split

win32/include/math.h+21−0
@@ -597,6 +597,27 @@ extern "C" { · 596 unmodified lines
597 return retval;597 return retval;
598 }598 }
599 599
600 #define FE_TONEAREST 0x0000
601 #define FE_DOWNWARD 0x0400
602 #define FE_UPWARD 0x0800
603 #define FE_TOWARDZERO 0x0c00
604
605 __CRT_INLINE double trunc (double _x)
606 {
607 double retval;
608 unsigned short saved_cw;
609 unsigned short tmp_cw;
610 __asm__ ("fnstcw %0;" : "=m" (saved_cw)); /* save FPU control word */
611 tmp_cw = (saved_cw & ~(FE_TONEAREST | FE_DOWNWARD | FE_UPWARD | FE_TOWARDZERO))
612 | FE_TOWARDZERO;
613 __asm__ ("fldcw %0;" : : "m" (tmp_cw));
614 __asm__ ("fldl %1;"
615 "frndint;"
616 "fstl %0;" : "=m" (retval) : "m" (_x)); /* round towards zero */
617 __asm__ ("fldcw %0;" : : "m" (saved_cw) ); /* restore saved control word */
618 return retval;
619 }
620
600 /* 7.12.9.6 */621 /* 7.12.9.6 */
601 /* round away from zero, regardless of fpu control word settings */622 /* round away from zero, regardless of fpu control word settings */
602 extern double __cdecl round (double);623 extern double __cdecl round (double);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t