mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 06:26:00 +00:00
Create a branch for Aleksandar Andrejevic for his work on NTVDM. See http://jira.reactos.org/browse/CORE-7250 for more details.
svn path=/branches/ntvdm/; revision=59241
This commit is contained in:
parent
3e3200acef
commit
4f0b8d3db0
20620 changed files with 0 additions and 1232833 deletions
41
lib/sdk/crt/math/amd64/floor.S
Normal file
41
lib/sdk/crt/math/amd64/floor.S
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* PURPOSE: Implementation of floor
|
||||
* FILE: lib/sdk/crt/math/amd64/floor.S
|
||||
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <asm.inc>
|
||||
|
||||
/* CODE **********************************************************************/
|
||||
.code64
|
||||
|
||||
PUBLIC floor
|
||||
FUNC floor
|
||||
sub rsp, 16
|
||||
.ENDPROLOG
|
||||
|
||||
/* Truncate xmm0 to integer (double precision) */
|
||||
cvttsd2si rcx, xmm0
|
||||
|
||||
/* Duplicate the bits into rax */
|
||||
movd rax, xmm0
|
||||
|
||||
/* Shift all bits to the right, keeping the sign bit */
|
||||
shr rax, 63
|
||||
|
||||
/* Substract the sign bit from the truncated value, so that
|
||||
we get the correct result for negative values. */
|
||||
sub rcx, rax
|
||||
|
||||
/* Convert the result back to xmm0 (double precision) */
|
||||
cvtsi2sd xmm0, rcx
|
||||
|
||||
add rsp, 16
|
||||
ret
|
||||
ENDFUNC
|
||||
|
||||
END
|
Loading…
Add table
Add a link
Reference in a new issue