summaryrefslogtreecommitdiffstats
path: root/vec_pseudo.h
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2013-07-02 22:35:41 -0400
committerErik Schnetter <schnetter@gmail.com>2013-07-02 22:35:41 -0400
commit2cfd4347353565804661483d66a60394af7c40f7 (patch)
tree20aa19d2541a52160919bfb1dc2b0336f3b8c57f /vec_pseudo.h
parente4fbcb8815d919662b9c100e7e2aed1ab5599add (diff)
downloadvecmathlib-2cfd4347353565804661483d66a60394af7c40f7.zip
vecmathlib-2cfd4347353565804661483d66a60394af7c40f7.tar.gz
Improve performance of ilogb and frexp
Diffstat (limited to 'vec_pseudo.h')
-rw-r--r--vec_pseudo.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/vec_pseudo.h b/vec_pseudo.h
index c3658c0..29f2ed0 100644
--- a/vec_pseudo.h
+++ b/vec_pseudo.h
@@ -752,8 +752,9 @@ namespace vecmathlib {
for (int d=0; d<size; ++d) {
int ir;
real_t r = std::frexp(v[d], &ir);
- if (ir == FP_ILOGB0) ir = std::numeric_limits<int_t>::min();
- else if (ir == FP_ILOGBNAN) ir = std::numeric_limits<int_t>::max();
+ typedef std::numeric_limits<int_t> NL;
+ if (FP_ILOGB0 != NL::min() and ir == FP_ILOGB0) ir = NL::min();
+ else if (FP_ILOGBNAN != NL::max() and ir == FP_ILOGBNAN) ir = NL::max();
res.v[d] = r;
ires.v[d] = ir;
}
@@ -765,8 +766,9 @@ namespace vecmathlib {
intvec_t res;
for (int d=0; d<size; ++d) {
int_t r = std::ilogb(v[d]);
- if (r == FP_ILOGB0) r = std::numeric_limits<int_t>::min();
- else if (r == FP_ILOGBNAN) r = std::numeric_limits<int_t>::max();
+ typedef std::numeric_limits<int_t> NL;
+ if (FP_ILOGB0 != NL::min() and r == FP_ILOGB0) r = NL::min();
+ else if (FP_ILOGBNAN != NL::max() and r == FP_ILOGBNAN) r = NL::max();
res.v[d] = r;
}
return res;
OpenPOWER on IntegriCloud