[PPL-devel] [GIT] ppl/ppl(master): Prefer explicit cast to implicit narrowing conversion.

Enea Zaffanella zaffanella at cs.unipr.it
Fri Aug 17 18:19:02 CEST 2012


Module: ppl/ppl
Branch: master
Commit: 55227bfc8118c5bc2d96808fff3df85af4d65860
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=55227bfc8118c5bc2d96808fff3df85af4d65860

Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date:   Fri Aug 17 18:18:12 2012 +0200

Prefer explicit cast to implicit narrowing conversion.
Detected by ECLAIR service utypflag.

---

 src/CO_Tree.cc |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/CO_Tree.cc b/src/CO_Tree.cc
index 68d49d4..e19b5d1 100644
--- a/src/CO_Tree.cc
+++ b/src/CO_Tree.cc
@@ -557,7 +557,8 @@ PPL::CO_Tree::init(dimension_type n) {
 
   if (n > 0) {
     init(0);
-    const dimension_type new_max_depth = integer_log2(n) + 1;
+    const dimension_type max_d = integer_log2(n) + 1;
+    const height_t new_max_depth = static_cast<height_t>(max_d);
     const dimension_type new_reserved_size
       = (static_cast<dimension_type>(1) << new_max_depth) - 1;
     // If this throws, *this will be the empty tree.




More information about the PPL-devel mailing list