diff options
author | pnv1 <pnv@ydb.tech> | 2023-04-27 19:15:07 +0300 |
---|---|---|
committer | pnv1 <pnv@ydb.tech> | 2023-04-27 19:15:07 +0300 |
commit | a66c59109292f9e0fb44ede41adfdebe569e4df3 (patch) | |
tree | 906b3d10274afd16e8e70c61ff416bff9075422e /contrib/libs/asmlib/round64.asm | |
parent | 9ca91b40d6f45546e20a646d15590c0cc6cc9778 (diff) | |
download | ydb-a66c59109292f9e0fb44ede41adfdebe569e4df3.tar.gz |
Switch to old asmlib to be able to build ydb cli without sse4
Diffstat (limited to 'contrib/libs/asmlib/round64.asm')
-rw-r--r-- | contrib/libs/asmlib/round64.asm | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/contrib/libs/asmlib/round64.asm b/contrib/libs/asmlib/round64.asm new file mode 100644 index 0000000000..5ed55c53c6 --- /dev/null +++ b/contrib/libs/asmlib/round64.asm @@ -0,0 +1,40 @@ +%include "defs.asm" + +; ROUND64.ASM
+
+; Author: Agner Fog
+; Date created: 2007-06-15
+; Last modified: 2008-10-16
+; Description:
+; Round function
+
+; Copyright (c) 2009 GNU General Public License www.gnu.org/licenses
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+default rel
+
+global RoundD: function
+global RoundF: function
+
+
+SECTION .text align=16
+
+; ********** round function **********
+; C++ prototype:
+; extern "C" int RoundD (double x);
+; extern "C" int RoundF (float x);
+
+; This function converts a single or double precision floating point number
+; to an integer, rounding to nearest or even. Does not check for overflow.
+; This function is much faster than the default conversion method in C++
+; which uses truncation.
+
+RoundD:
+ cvtsd2si eax, xmm0 ; Round xmm0 to eax
+ ret
+;RoundD ENDP
+
+RoundF:
+ cvtss2si eax, xmm0 ; Round xmm0 to eax
+ ret
+;RoundF ENDP
|