aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/sleef/seh-cpu-ext.diff
blob: 6cd8eaa3cb488fbfd4f43a05c6fb6b05dec24e9b (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/src/libm/dispatcher.h b/src/libm/dispatcher.h
index 41b69d9..4d395c3 100644
--- a/src/libm/dispatcher.h
+++ b/src/libm/dispatcher.h
@@ -27,6 +27,14 @@ NOEXPORT int Sleef_internal_cpuSupportsExt(void (*tryExt)(), int *cache) {
   static int cache = -1;
   if (cache != -1) return cache;
 
+#ifdef _MSC_VER
+  __try {
+    (*tryExt)();
+    cache = 1;
+  } __except(1) {
+    cache = 0;
+  }
+#else
   void (*org);
   org = signal(SIGILL, sighandler);
 
@@ -38,5 +46,6 @@ NOEXPORT int Sleef_internal_cpuSupportsExt(void (*tryExt)(), int *cache) {
   }
 
   signal(SIGILL, org);
+#endif
   return cache;
 }