| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,21 +14,13 @@ typedef struct { | |||
| 14 | 14 | ||
| 15 | 15 | /* Operations on complex numbers from complexmodule.c */ | |
| 16 | 16 | ||
| 17 | - #define c_sum _Py_c_sum | ||
| 18 | - #define c_diff _Py_c_diff | ||
| 19 | - #define c_neg _Py_c_neg | ||
| 20 | - #define c_prod _Py_c_prod | ||
| 21 | - #define c_quot _Py_c_quot | ||
| 22 | - #define c_pow _Py_c_pow | ||
| 23 | - #define c_abs _Py_c_abs | ||
| 24 | - | ||
| 25 | - PyAPI_FUNC(Py_complex) c_sum(Py_complex, Py_complex); | ||
| 26 | - PyAPI_FUNC(Py_complex) c_diff(Py_complex, Py_complex); | ||
| 27 | - PyAPI_FUNC(Py_complex) c_neg(Py_complex); | ||
| 28 | - PyAPI_FUNC(Py_complex) c_prod(Py_complex, Py_complex); | ||
| 29 | - PyAPI_FUNC(Py_complex) c_quot(Py_complex, Py_complex); | ||
| 30 | - PyAPI_FUNC(Py_complex) c_pow(Py_complex, Py_complex); | ||
| 31 | - PyAPI_FUNC(double) c_abs(Py_complex); | ||
| 17 | + PyAPI_FUNC(Py_complex) _Py_c_sum(Py_complex, Py_complex); | ||
| 18 | + PyAPI_FUNC(Py_complex) _Py_c_diff(Py_complex, Py_complex); | ||
| 19 | + PyAPI_FUNC(Py_complex) _Py_c_neg(Py_complex); | ||
| 20 | + PyAPI_FUNC(Py_complex) _Py_c_prod(Py_complex, Py_complex); | ||
| 21 | + PyAPI_FUNC(Py_complex) _Py_c_quot(Py_complex, Py_complex); | ||
| 22 | + PyAPI_FUNC(Py_complex) _Py_c_pow(Py_complex, Py_complex); | ||
| 23 | + PyAPI_FUNC(double) _Py_c_abs(Py_complex); | ||
| 32 | 24 | #endif | |
| 33 | 25 | ||
| 34 | 26 | /* Complex object interface */ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,7 +13,7 @@ | |||
| 13 | 13 | static Py_complex c_1 = {1., 0.}; | |
| 14 | 14 | ||
| 15 | 15 | Py_complex | |
| 16 | - c_sum(Py_complex a, Py_complex b) | ||
| 16 | + _Py_c_sum(Py_complex a, Py_complex b) | ||
| 17 | 17 | { | |
| 18 | 18 | Py_complex r; | |
| 19 | 19 | r.real = a.real + b.real; | |
@@ -22,7 +22,7 @@ c_sum(Py_complex a, Py_complex b) | |||
| 22 | 22 | } | |
| 23 | 23 | ||
| 24 | 24 | Py_complex | |
| 25 | - c_diff(Py_complex a, Py_complex b) | ||
| 25 | + _Py_c_diff(Py_complex a, Py_complex b) | ||
| 26 | 26 | { | |
| 27 | 27 | Py_complex r; | |
| 28 | 28 | r.real = a.real - b.real; | |
@@ -31,7 +31,7 @@ c_diff(Py_complex a, Py_complex b) | |||
| 31 | 31 | } | |
| 32 | 32 | ||
| 33 | 33 | Py_complex | |
| 34 | - c_neg(Py_complex a) | ||
| 34 | + _Py_c_neg(Py_complex a) | ||
| 35 | 35 | { | |
| 36 | 36 | Py_complex r; | |
| 37 | 37 | r.real = -a.real; | |
@@ -40,7 +40,7 @@ c_neg(Py_complex a) | |||
| 40 | 40 | } | |
| 41 | 41 | ||
| 42 | 42 | Py_complex | |
| 43 | - c_prod(Py_complex a, Py_complex b) | ||
| 43 | + _Py_c_prod(Py_complex a, Py_complex b) | ||
| 44 | 44 | { | |
| 45 | 45 | Py_complex r; | |
| 46 | 46 | r.real = a.real*b.real - a.imag*b.imag; | |
@@ -49,7 +49,7 @@ c_prod(Py_complex a, Py_complex b) | |||
| 49 | 49 | } | |
| 50 | 50 | ||
| 51 | 51 | Py_complex | |
| 52 | - c_quot(Py_complex a, Py_complex b) | ||
| 52 | + _Py_c_quot(Py_complex a, Py_complex b) | ||
| 53 | 53 | { | |
| 54 | 54 | /****************************************************************** | |
| 55 | 55 | This was the original algorithm. It's grossly prone to spurious | |
@@ -103,7 +103,7 @@ c_quot(Py_complex a, Py_complex b) | |||
| 103 | 103 | } | |
| 104 | 104 | ||
| 105 | 105 | Py_complex | |
| 106 | - c_pow(Py_complex a, Py_complex b) | ||
| 106 | + _Py_c_pow(Py_complex a, Py_complex b) | ||
| 107 | 107 | { | |
| 108 | 108 | Py_complex r; | |
| 109 | 109 | double vabs,len,at,phase; | |
@@ -141,9 +141,9 @@ c_powu(Py_complex x, long n) | |||
| 141 | 141 | p = x; | |
| 142 | 142 | while (mask > 0 && n >= mask) { | |
| 143 | 143 | if (n & mask) | |
| 144 | - r = c_prod(r,p); | ||
| 144 | + r = _Py_c_prod(r,p); | ||
| 145 | 145 | mask <<= 1; | |
| 146 | - p = c_prod(p,p); | ||
| 146 | + p = _Py_c_prod(p,p); | ||
| 147 | 147 | } | |
| 148 | 148 | return r; | |
| 149 | 149 | } | |
@@ -156,17 +156,17 @@ c_powi(Py_complex x, long n) | |||
| 156 | 156 | if (n > 100 || n < -100) { | |
| 157 | 157 | cn.real = (double) n; | |
| 158 | 158 | cn.imag = 0.; | |
| 159 | - return c_pow(x,cn); | ||
| 159 | + return _Py_c_pow(x,cn); | ||
| 160 | 160 | } | |
| 161 | 161 | else if (n > 0) | |
| 162 | 162 | return c_powu(x,n); | |
| 163 | 163 | else | |
| 164 | - return c_quot(c_1,c_powu(x,-n)); | ||
| 164 | + return _Py_c_quot(c_1, c_powu(x,-n)); | ||
| 165 | 165 | ||
| 166 | 166 | } | |
| 167 | 167 | ||
| 168 | 168 | double | |
| 169 | - c_abs(Py_complex z) | ||
| 169 | + _Py_c_abs(Py_complex z) | ||
| 170 | 170 | { | |
| 171 | 171 | /* sets errno = ERANGE on overflow; otherwise errno = 0 */ | |
| 172 | 172 | double result; | |
@@ -441,7 +441,7 @@ complex_add(PyObject *v, PyObject *w) | |||
| 441 | 441 | TO_COMPLEX(v, a); | |
| 442 | 442 | TO_COMPLEX(w, b); | |
| 443 | 443 | PyFPE_START_PROTECT("complex_add", return 0) | |
| 444 | - result = c_sum(a, b); | ||
| 444 | + result = _Py_c_sum(a, b); | ||
| 445 | 445 | PyFPE_END_PROTECT(result) | |
| 446 | 446 | return PyComplex_FromCComplex(result); | |
| 447 | 447 | } | |
@@ -454,7 +454,7 @@ complex_sub(PyObject *v, PyObject *w) | |||
| 454 | 454 | TO_COMPLEX(v, a); | |
| 455 | 455 | TO_COMPLEX(w, b); | |
| 456 | 456 | PyFPE_START_PROTECT("complex_sub", return 0) | |
| 457 | - result = c_diff(a, b); | ||
| 457 | + result = _Py_c_diff(a, b); | ||
| 458 | 458 | PyFPE_END_PROTECT(result) | |
| 459 | 459 | return PyComplex_FromCComplex(result); | |
| 460 | 460 | } | |
@@ -467,7 +467,7 @@ complex_mul(PyObject *v, PyObject *w) | |||
| 467 | 467 | TO_COMPLEX(v, a); | |
| 468 | 468 | TO_COMPLEX(w, b); | |
| 469 | 469 | PyFPE_START_PROTECT("complex_mul", return 0) | |
| 470 | - result = c_prod(a, b); | ||
| 470 | + result = _Py_c_prod(a, b); | ||
| 471 | 471 | PyFPE_END_PROTECT(result) | |
| 472 | 472 | return PyComplex_FromCComplex(result); | |
| 473 | 473 | } | |
@@ -481,7 +481,7 @@ complex_div(PyObject *v, PyObject *w) | |||
| 481 | 481 | TO_COMPLEX(w, b); | |
| 482 | 482 | PyFPE_START_PROTECT("complex_div", return 0) | |
| 483 | 483 | errno = 0; | |
| 484 | - quot = c_quot(a, b); | ||
| 484 | + quot = _Py_c_quot(a, b); | ||
| 485 | 485 | PyFPE_END_PROTECT(quot) | |
| 486 | 486 | if (errno == EDOM) { | |
| 487 | 487 | PyErr_SetString(PyExc_ZeroDivisionError, "complex division by zero"); | |
@@ -528,7 +528,7 @@ complex_pow(PyObject *v, PyObject *w, PyObject *z) | |||
| 528 | 528 | if (exponent.imag == 0. && exponent.real == int_exponent) | |
| 529 | 529 | p = c_powi(a, int_exponent); | |
| 530 | 530 | else | |
| 531 | - p = c_pow(a, exponent); | ||
| 531 | + p = _Py_c_pow(a, exponent); | ||
| 532 | 532 | ||
| 533 | 533 | PyFPE_END_PROTECT(p) | |
| 534 | 534 | Py_ADJUST_ERANGE2(p.real, p.imag); | |
@@ -579,7 +579,7 @@ complex_abs(PyComplexObject *v) | |||
| 579 | 579 | double result; | |
| 580 | 580 | ||
| 581 | 581 | PyFPE_START_PROTECT("complex_abs", return 0) | |
| 582 | - result = c_abs(v->cval); | ||
| 582 | + result = _Py_c_abs(v->cval); | ||
| 583 | 583 | PyFPE_END_PROTECT(result) | |
| 584 | 584 | ||
| 585 | 585 | if (errno == ERANGE) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments