Skip to content

Commit 25629dd

Browse files
committed
TASK: rename macros (from review)
1 parent d1cbf3f commit 25629dd

File tree

3 files changed

+23
-25
lines changed

3 files changed

+23
-25
lines changed

numpy/core/setup_common.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,6 @@ def set_sig(sig):
142142
"ftello", "fseeko"
143143
]
144144

145-
# TODO: make these mandatory and use BLOCK_ macros rather than HAVE_ macros
146-
# in npy_config.h and throughout the code
147145
C99_COMPLEX_TYPES = [
148146
'complex double', 'complex float', 'complex long double'
149147
]

numpy/core/src/common/npy_config.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@
1111
/* Disable broken functions on z/OS */
1212
#if defined (__MVS__)
1313

14-
#define BLOCK_POWF
15-
#define BLOCK_EXPF
14+
#define NPY_BLOCK_POWF
15+
#define NPY_BLOCK_EXPF
1616
#undef HAVE___THREAD
1717

1818
#endif
1919

2020
/* Disable broken MS math functions */
2121
#if defined(__MINGW32_VERSION)
2222

23-
#define BLOCK_ATAN2
24-
#define BLOCK_ATAN2F
25-
#define BLOCK_ATAN2L
23+
#define NPY_BLOCK_ATAN2
24+
#define NPY_BLOCK_ATAN2F
25+
#define NPY_BLOCK_ATAN2L
2626

27-
#define BLOCK_HYPOT
28-
#define BLOCK_HYPOTF
29-
#define BLOCK_HYPOTL
27+
#define NPY_BLOCK_HYPOT
28+
#define NPY_BLOCK_HYPOTF
29+
#define NPY_BLOCK_HYPOTL
3030

3131
#endif
3232

@@ -66,23 +66,23 @@
6666
#undef HAVE_CABSF
6767
#undef HAVE_CABSL
6868

69-
#define BLOCK_HYPOT
70-
#define BLOCK_HYPOTF
71-
#define BLOCK_HYPOTL
69+
#define NPY_BLOCK_HYPOT
70+
#define NPY_BLOCK_HYPOTF
71+
#define NPY_BLOCK_HYPOTL
7272

7373
#endif
7474

7575

7676
/* Intel C for Windows uses POW for 64 bits longdouble*/
7777
#if defined(_MSC_VER) && defined(__INTEL_COMPILER)
7878
#if NPY_SIZEOF_LONGDOUBLE == 8
79-
#define BLOCK_POWL
79+
#define NPY_BLOCK_POWL
8080
#endif
8181
#endif /* defined(_MSC_VER) && defined(__INTEL_COMPILER) */
8282

8383
/* powl gives zero division warning on OS X, see gh-8307 */
8484
#if defined(NPY_OS_DARWIN)
85-
#define BLOCK_POWL
85+
#define NPY_BLOCK_POWL
8686
#endif
8787

8888
#ifdef __CYGWIN__
@@ -119,7 +119,7 @@
119119
#undef HAVE_CACOS
120120

121121
/* log2(exp2(i)) off by a few eps */
122-
#define BLOCK_LOG2
122+
#define NPY_BLOCK_LOG2
123123

124124
/* np.power(..., dtype=np.complex256) doesn't report overflow */
125125
#undef HAVE_CPOWL

numpy/core/src/npymath/npy_math_internal.h.src

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ NPY_INPLACE double npy_modf(double x, double *iptr)
119119
*/
120120
NPY_INPLACE double npy_log2(double x)
121121
{
122-
#ifndef BLOCK_LOG2
122+
#ifndef NPY_BLOCK_LOG2
123123
return log2(x);
124124
#else
125125
if (!npy_isfinite(x) || x <= 0.) {
@@ -159,7 +159,7 @@ NPY_INPLACE double npy_log2(double x)
159159
#define NPY_DBL_EPSILON 1.2246467991473531772E-16
160160
NPY_INPLACE double npy_atan2(double y, double x)
161161
{
162-
#ifndef BLOCK_ATAN2
162+
#ifndef NPY_BLOCK_ATAN2
163163
return atan2(y, x);
164164
#else
165165
npy_int32 k, m, iy, ix, hx, hy;
@@ -243,7 +243,7 @@ NPY_INPLACE double npy_atan2(double y, double x)
243243

244244
NPY_INPLACE double npy_hypot(double x, double y)
245245
{
246-
#ifndef BLOCK_HYPOT
246+
#ifndef NPY_BLOCK_HYPOT
247247
return hypot(x, y);
248248
#else
249249
double yx;
@@ -390,14 +390,14 @@ NPY_INPLACE @type@ npy_cbrt@c@(@type@ x)
390390
#ifdef @kind@@c@
391391
#undef @kind@@c@
392392
#endif
393-
#ifdef BLOCK_@KIND@@C@
393+
#ifdef NPY_BLOCK_@KIND@@C@
394394
NPY_INPLACE @type@ npy_@kind@@c@(@type@ x)
395395
{
396396
return (@type@) npy_@kind@((double)x);
397397
}
398398
#endif
399399

400-
#ifndef BLOCK_@KIND@@C@
400+
#ifndef NPY_BLOCK_@KIND@@C@
401401
NPY_INPLACE @type@ npy_@kind@@c@(@type@ x)
402402
{
403403
return NPY__FP_SFX(@kind@)(x);
@@ -414,14 +414,14 @@ NPY_INPLACE @type@ npy_@kind@@c@(@type@ x)
414414
#ifdef @kind@@c@
415415
#undef @kind@@c@
416416
#endif
417-
#ifdef BLOCK_@KIND@@C@
417+
#ifdef NPY_BLOCK_@KIND@@C@
418418
NPY_INPLACE @type@ npy_@kind@@c@(@type@ x, @type@ y)
419419
{
420420
return (@type@) npy_@kind@((double)x, (double) y);
421421
}
422422
#endif
423423

424-
#ifndef BLOCK_@KIND@@C@
424+
#ifndef NPY_BLOCK_@KIND@@C@
425425
NPY_INPLACE @type@ npy_@kind@@c@(@type@ x, @type@ y)
426426
{
427427
return NPY__FP_SFX(@kind@)(x, y);
@@ -432,7 +432,7 @@ NPY_INPLACE @type@ npy_@kind@@c@(@type@ x, @type@ y)
432432
#ifdef modf@c@
433433
#undef modf@c@
434434
#endif
435-
#ifdef BLOCK_MODF@C@
435+
#ifdef NPY_BLOCK_MODF@C@
436436
NPY_INPLACE @type@ npy_modf@c@(@type@ x, @type@ *iptr)
437437
{
438438
double niptr;
@@ -442,7 +442,7 @@ NPY_INPLACE @type@ npy_modf@c@(@type@ x, @type@ *iptr)
442442
}
443443
#endif
444444

445-
#ifndef BLOCK_MODF@C@
445+
#ifndef NPY_BLOCK_MODF@C@
446446
NPY_INPLACE @type@ npy_modf@c@(@type@ x, @type@ *iptr)
447447
{
448448
return NPY__FP_SFX(modf)(x, iptr);

0 commit comments

Comments
 (0)