Skip to content

Latest commit

 

History

History
30 lines (26 loc) · 823 Bytes

0001-misc-mingw64.patch

File metadata and controls

30 lines (26 loc) · 823 Bytes
 
Oct 6, 2019
Oct 6, 2019
1
use xmm intrinsics for lrintf with mingw-w64
Oct 6, 2019
Oct 6, 2019
3
4
5
diff -u opusfile/src/opusfile.c~ opusfile/src/opusfile.c
--- opusfile/src/opusfile.c~
+++ opusfile/src/opusfile.c
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
@@ -25,7 +25,9 @@
#include <limits.h>
#include <string.h>
#include <math.h>
-
+#if defined(_WIN64) && (defined(__x86_64__) || defined(_M_X64))
+#include <xmmintrin.h>
+#endif
#include "opusfile.h"
/*This implementation is largely based off of libvorbisfile.
@@ -3129,8 +3131,11 @@
#else
-# if defined(OP_HAVE_LRINTF)
-# include <math.h>
+# if defined(_WIN64) && (defined(__x86_64__) || defined(_M_X64))
+ static __inline long int op_float2int(float _x) {
+ return _mm_cvtss_si32(_mm_load_ss(&_x));
+ }
+# elif defined(OP_HAVE_LRINTF)
# define op_float2int(_x) (lrintf(_x))
# else
# define op_float2int(_x) ((int)((_x)+((_x)<0?-0.5F:0.5F)))