aboutsummaryrefslogtreecommitdiff
path: root/ports/sdl2-gfx/001-lrint-arm64.patch
blob: 50de17973d43b562b15cbd1d78e4467e1c9b2ff0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
diff --git a/SDL2_gfxPrimitives.c b/SDL2_gfxPrimitives.c
index f81e6da..91817fd 100755
--- a/SDL2_gfxPrimitives.c
+++ b/SDL2_gfxPrimitives.c
@@ -1771,8 +1771,20 @@ __declspec(naked) long int
 	__emit(0xE12FFF1E); // bx     lr
 }
 #pragma warning(pop)
+#elif defined(_M_ARM64)
+#include <intrin.h>
+#pragma warning(push)
+#pragma warning(disable: 4716)
+__declspec(naked) long
+	lrint (double f)
+{
+	__emit(0x1e674000); // frintx d0, d0
+	__emit(0x9e780000); // fcvtzs x0, d0
+	__emit(0xd65f03c0); // ret
+}
+#pragma warning(pop)
 #else
-#error lrint needed for MSVC on non X86/AMD64/ARM targets.
+#error lrint needed for MSVC on non X86/AMD64/ARM/ARM64 targets.
 #endif
 #endif