projects
/
libm
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
21d0f5c
)
prefer (uint)-1>>1 to ~((uint)1<<n), remove some unnecessary ()
author
nsz
<nsz@port70.net>
Tue, 6 Mar 2012 18:34:26 +0000
(19:34 +0100)
committer
nsz
<nsz@port70.net>
Tue, 6 Mar 2012 18:34:26 +0000
(19:34 +0100)
src/math/__fpclassifyl.c
patch
|
blob
|
history
src/math/copysign.c
patch
|
blob
|
history
src/math/copysignf.c
patch
|
blob
|
history
src/math/ilogbl.c
patch
|
blob
|
history
src/math/modf.c
patch
|
blob
|
history
src/math/modff.c
patch
|
blob
|
history
src/math/sqrt.c
patch
|
blob
|
history
diff --git
a/src/math/__fpclassifyl.c
b/src/math/__fpclassifyl.c
index
c886e5a
..
a5ad36f
100644
(file)
--- a/
src/math/__fpclassifyl.c
+++ b/
src/math/__fpclassifyl.c
@@
-10,7
+10,7
@@
int __fpclassifyl(long double x)
if (!e)
return u.bits.m ? FP_SUBNORMAL : FP_ZERO;
if (e == 0x7fff)
if (!e)
return u.bits.m ? FP_SUBNORMAL : FP_ZERO;
if (e == 0x7fff)
- return u.bits.m &
~((uint64_t)1<<63)
? FP_NAN : FP_INFINITE;
+ return u.bits.m &
(uint64_t)-1>>1
? FP_NAN : FP_INFINITE;
return u.bits.m & (uint64_t)1<<63 ? FP_NORMAL : FP_NAN;
}
#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384
return u.bits.m & (uint64_t)1<<63 ? FP_NORMAL : FP_NAN;
}
#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384
diff --git
a/src/math/copysign.c
b/src/math/copysign.c
index
04e1869
..
038b8b4
100644
(file)
--- a/
src/math/copysign.c
+++ b/
src/math/copysign.c
@@
-5,7
+5,7
@@
double copysign(double x, double y) {
ux.value = x;
uy.value = y;
ux.value = x;
uy.value = y;
- ux.bits &=
~((uint64_t)1<<63)
;
+ ux.bits &=
(uint64_t)-1>>1
;
ux.bits |= uy.bits & (uint64_t)1<<63;
return ux.value;
}
ux.bits |= uy.bits & (uint64_t)1<<63;
return ux.value;
}
diff --git
a/src/math/copysignf.c
b/src/math/copysignf.c
index
bf6e1c1
..
47ab37e
100644
(file)
--- a/
src/math/copysignf.c
+++ b/
src/math/copysignf.c
@@
-5,7
+5,7
@@
float copysignf(float x, float y) {
ux.value = x;
uy.value = y;
ux.value = x;
uy.value = y;
- ux.bits &=
~(uint32_t)1<<3
1;
+ ux.bits &=
(uint32_t)-1>>
1;
ux.bits |= uy.bits & (uint32_t)1<<31;
return ux.value;
}
ux.bits |= uy.bits & (uint32_t)1<<31;
return ux.value;
}
diff --git
a/src/math/ilogbl.c
b/src/math/ilogbl.c
index
099c81a
..
3b42c4d
100644
(file)
--- a/
src/math/ilogbl.c
+++ b/
src/math/ilogbl.c
@@
-21,7
+21,7
@@
int ilogbl(long double x)
}
if (e == 0x7fff)
/* in ld80 msb is set in inf */
}
if (e == 0x7fff)
/* in ld80 msb is set in inf */
- return m &
~((uint64_t)1<<63)
? FP_ILOGBNAN : INT_MAX;
+ return m &
(uint64_t)-1>>1
? FP_ILOGBNAN : INT_MAX;
return e - 0x3fff;
}
#endif
return e - 0x3fff;
}
#endif
diff --git
a/src/math/modf.c
b/src/math/modf.c
index
362733e
..
ff85b2a
100644
(file)
--- a/
src/math/modf.c
+++ b/
src/math/modf.c
@@
-43,7
+43,7
@@
double modf(double x, double *iptr)
INSERT_WORDS(x, high & 0x80000000, 0); /* return +-0 */
return x;
}
INSERT_WORDS(x, high & 0x80000000, 0); /* return +-0 */
return x;
}
- INSERT_WORDS(*iptr, i0&
(~i)
, 0);
+ INSERT_WORDS(*iptr, i0&
~i
, 0);
return x - *iptr;
} else if (j0 > 51) { /* no fraction part */
uint32_t high;
return x - *iptr;
} else if (j0 > 51) { /* no fraction part */
uint32_t high;
@@
-64,7
+64,7
@@
double modf(double x, double *iptr)
INSERT_WORDS(x, high & 0x80000000, 0); /* return +-0 */
return x;
}
INSERT_WORDS(x, high & 0x80000000, 0); /* return +-0 */
return x;
}
- INSERT_WORDS(*iptr, i0, i1&
(~i)
);
+ INSERT_WORDS(*iptr, i0, i1&
~i
);
return x - *iptr;
}
}
return x - *iptr;
}
}
diff --git
a/src/math/modff.c
b/src/math/modff.c
index
7ab10a5
..
d535314
100644
(file)
--- a/
src/math/modff.c
+++ b/
src/math/modff.c
@@
-37,7
+37,7
@@
float modff(float x, float *iptr)
SET_FLOAT_WORD(x, ix & 0x80000000); /* return +-0 */
return x;
}
SET_FLOAT_WORD(x, ix & 0x80000000); /* return +-0 */
return x;
}
- SET_FLOAT_WORD(*iptr, i0&
(~i)
);
+ SET_FLOAT_WORD(*iptr, i0&
~i
);
return x - *iptr;
} else { /* no fraction part */
uint32_t ix;
return x - *iptr;
} else { /* no fraction part */
uint32_t ix;
diff --git
a/src/math/sqrt.c
b/src/math/sqrt.c
index
e4b166d
..
2ebd022
100644
(file)
--- a/
src/math/sqrt.c
+++ b/
src/math/sqrt.c
@@
-95,7
+95,7
@@
double sqrt(double x)
}
/* take care of zero */
if (ix0 <= 0) {
}
/* take care of zero */
if (ix0 <= 0) {
- if (((ix0&
(~sign)
)|ix1) == 0)
+ if (((ix0&
~sign
)|ix1) == 0)
return x; /* sqrt(+-0) = +-0 */
if (ix0 < 0)
return (x-x)/(x-x); /* sqrt(-ve) = sNaN */
return x; /* sqrt(+-0) = +-0 */
if (ix0 < 0)
return (x-x)/(x-x); /* sqrt(-ve) = sNaN */