0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync; $Id$
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync;; @file
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync; IPRT - No-CRT truncl - AMD64 & X86.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync; Copyright (C) 2006-2010 Oracle Corporation
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync;
c7814cf6e1240a519cbec0441e033d0e2470ed00vboxsync; This file is part of VirtualBox Open Source Edition (OSE), as
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync; available from http://www.virtualbox.org. This file is free software;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync; you can redistribute it and/or modify it under the terms of the GNU
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync; General Public License (GPL) as published by the Free Software
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync; Foundation, in version 2 as it comes in the "COPYING" file of the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync; The contents of this file may alternatively be used under the terms
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync; of the Common Development and Distribution License Version 1.0
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync; VirtualBox OSE distribution, in which case the provisions of the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync; CDDL are applicable instead of those of the GPL.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync; You may elect to license modified versions of this file under the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync; terms and conditions of either the GPL or the CDDL or both.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync%include "iprt/asmdefs.mac"
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncBEGINCODE
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync;;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync; Round to truncated integer value.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync; @returns st(0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync; @param rd [rbp + 8]
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncBEGINPROC RT_NOCRT(truncl)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync push xBP
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync mov xBP, xSP
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync sub xSP, 10h
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync fld tword [xBP + xCB*2]
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync ; Make it truncate up by modifying the fpu control word.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync fstcw [xBP - 10h]
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync mov eax, [xBP - 10h]
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync or eax, 00c00h
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync mov [xBP - 08h], eax
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync fldcw [xBP - 08h]
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync ; Round ST(0) to integer.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync frndint
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync ; Restore the fpu control word.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync fldcw [xBP - 10h]
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync leave
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync ret
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncENDPROC RT_NOCRT(truncl)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync