2010-07-21 16:03:44 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS system libraries
|
|
|
|
* PURPOSE: Implementation of tan
|
|
|
|
* FILE: lib/sdk/crt/math/amd64/floorf.S
|
|
|
|
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES ******************************************************************/
|
|
|
|
|
|
|
|
#include <reactos/asm.h>
|
|
|
|
#include <ndk/amd64/asm.h>
|
|
|
|
|
|
|
|
/* FUNCTIONS ****************************************************************/
|
|
|
|
|
|
|
|
.code64
|
|
|
|
|
|
|
|
PUBLIC floorf
|
|
|
|
floorf:
|
2010-11-02 00:06:33 +00:00
|
|
|
sub rsp, 16
|
|
|
|
|
2010-07-21 16:03:44 +00:00
|
|
|
/* Put parameter on the stack */
|
2010-11-02 00:06:33 +00:00
|
|
|
movss [rsp], xmm0
|
2010-07-21 16:03:44 +00:00
|
|
|
fld dword ptr [rsp]
|
|
|
|
|
|
|
|
/* Change fpu control word to round down */
|
2010-11-02 00:06:33 +00:00
|
|
|
fstcw [rsp]
|
|
|
|
mov eax, [rsp]
|
2010-07-21 16:03:44 +00:00
|
|
|
or eax, 0x00400
|
|
|
|
and eax, 0x0f7ff
|
2010-11-02 00:06:33 +00:00
|
|
|
mov [rsp + 8], eax
|
|
|
|
fldcw [rsp + 8]
|
2010-07-21 16:03:44 +00:00
|
|
|
|
|
|
|
/* Round to integer */
|
|
|
|
frndint
|
|
|
|
|
|
|
|
/* Restore fpu control word */
|
2010-11-02 00:06:33 +00:00
|
|
|
fldcw [rsp]
|
2010-07-21 16:03:44 +00:00
|
|
|
|
2010-11-02 00:06:33 +00:00
|
|
|
fstp dword ptr [rsp]
|
|
|
|
movss xmm0, [rsp]
|
|
|
|
add rsp, 16
|
2010-07-21 16:03:44 +00:00
|
|
|
ret
|
2010-11-02 00:06:33 +00:00
|
|
|
|
|
|
|
END
|