Skip to content

Commit c9b12af

Browse files
Merge pull request #4980 from chrishavlin/fix_platform_deps
2 parents f39ed50 + 851d57e commit c9b12af

File tree

2 files changed

+8
-53
lines changed

2 files changed

+8
-53
lines changed

.github/workflows/wheels.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
matrix:
2222
os: [
2323
ubuntu-20.04,
24-
windows-2019,
24+
windows-2022,
2525
macos-13, # x86_64
2626
macos-14, # arm64
2727
]

yt/utilities/lib/platform_dep.h

Lines changed: 7 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,14 @@
11
#include <math.h>
22
#ifdef MS_WIN32
33
#include "malloc.h"
4+
/*
5+
note: the following implicitly sets a mininum VS version: conservative
6+
minimum is _MSC_VER >= 1928 (VS 2019, 16.8), but may work for VS 2015
7+
but that has not been tested. see https://github.com/yt-project/yt/pull/4980
8+
and https://learn.microsoft.com/en-us/cpp/overview/visual-cpp-language-conformance
9+
*/
410
#include <float.h>
5-
typedef int int32_t;
6-
typedef long long int64_t;
7-
/* Taken from http://siliconandlithium.blogspot.com/2014/05/msvc-c99-mathh-header.html */
8-
#define isnormal(x) ((_fpclass(x) == _FPCLASS_NN) || (_fpclass(x) == _FPCLASS_PN))
9-
static __inline double rint(double x){
10-
const double two_to_52 = 4.5035996273704960e+15;
11-
double fa = fabs(x);
12-
if(fa >= two_to_52){
13-
return x;
14-
} else{
15-
return copysign(two_to_52 + fa - two_to_52, x);
16-
}
17-
}
18-
#if _MSC_VER < 1928
19-
static __inline long int lrint(double x){
20-
return (long)rint(x);
21-
}
22-
#endif
23-
static __inline double fmax(double x, double y){
24-
return (x > y) ? x : y;
25-
}
26-
static __inline double fmin(double x, double y){
27-
return (x < y) ? x : y;
28-
}
29-
30-
/* adapted from http://www.johndcook.com/blog/cpp_erf/
31-
code is under public domain license */
32-
33-
double erf(double x)
34-
{
35-
/* constants */
36-
double a1 = 0.254829592;
37-
double a2 = -0.284496736;
38-
double a3 = 1.421413741;
39-
double a4 = -1.453152027;
40-
double a5 = 1.061405429;
41-
double p = 0.3275911;
42-
double t;
43-
double y;
44-
45-
/* Save the sign of x */
46-
int sign = 1;
47-
if (x < 0)
48-
sign = -1;
49-
x = fabs(x);
50-
51-
/* A&S formula 7.1.26 */
52-
t = 1.0/(1.0 + p*x);
53-
y = 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x);
54-
55-
return sign*y;
56-
}
11+
#include <stdint.h>
5712
#elif defined(__FreeBSD__)
5813
#include <stdint.h>
5914
#include <stdlib.h>

0 commit comments

Comments
 (0)