summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormdroe <mdroe@stsci.edu>2014-06-12 18:30:53 -0400
committermdroe <mdroe@stsci.edu>2014-06-12 18:30:53 -0400
commitfc4dd7856158715a53b3f7061fdd148eada1ffb2 (patch)
treeb4ad8e1093a5a3172dab5c24ab02a765efd472ff /src
parentabb82674a02efc161b130f8ffb2b60063d1e3583 (diff)
downloadstsci.sphere-fc4dd7856158715a53b3f7061fdd148eada1ffb2.tar.gz
Minor cleanups to C extension.
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci.sphere/trunk@32440 fe389314-cf27-0410-b35b-8c050e845b92 Former-commit-id: 82846b251f2552c8dfb250e84e5c511f5b2b6fa9
Diffstat (limited to 'src')
-rw-r--r--src/math_util.c30
1 files changed, 4 insertions, 26 deletions
diff --git a/src/math_util.c b/src/math_util.c
index 2cbe009..9dbb32a 100644
--- a/src/math_util.c
+++ b/src/math_util.c
@@ -124,7 +124,7 @@ normalize(double *A) {
static inline void
normalizel(long double *A) {
long double l = A[0]*A[0] + A[1]*A[1] + A[2]*A[2];
- if (l != 1.0) {
+ if (l != 1.0L) {
l = sqrtl(l);
A[0] /= l;
A[1] /= l;
@@ -132,29 +132,14 @@ normalizel(long double *A) {
}
}
-static inline double
-dot(const double *A, const double *B) {
- return A[0]*B[0] + A[1]*B[1] + A[2]*B[2];
-}
-
static inline long double
dotl(const long double *A, const long double *B) {
return A[0]*B[0] + A[1]*B[1] + A[2]*B[2];
}
-static inline double
-sign(const double A) {
- return (A == 0.0) ? 0.0 : ((A < 0.0) ? -1.0 : 1.0);
-}
-
static inline long double
signl(const long double A) {
- return (A == 0.0) ? 0.0 : ((A < 0.0) ? -1.0 : 1.0);
-}
-
-static inline int
-equals(const double *A, const double *B) {
- return A[0] == B[0] && A[1] == B[1] && A[2] == B[2];
+ return (A == 0.0L) ? 0.0L : ((A < 0.0L) ? -1.0L : 1.0L);
}
static inline int
@@ -163,13 +148,6 @@ equalsl(const long double *A, const long double *B) {
}
static inline void
-mult(double *T, const double f) {
- T[0] *= f;
- T[1] *= f;
- T[2] *= f;
-}
-
-static inline void
multl(long double *T, const long double f) {
T[0] *= f;
T[1] *= f;
@@ -182,7 +160,7 @@ lengthl(long double *A, long double *B) {
/* Special case for "exactly equal" that avoids all of the calculation. */
if (equalsl(A, B)) {
- return 0;
+ return 0.0L;
}
s = dotl(A, B);
@@ -449,7 +427,7 @@ DOUBLE_intersects_point(char **args, intp *dimensions, intp *steps, void *NPY_UN
diff = fabsl((left + right) - total);
- *((uint8_t *)op) = diff < 1e-10;
+ *((uint8_t *)op) = diff < 1e-10L;
END_OUTER_LOOP
}