]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Ensure a left-shift operation happens in the right data type. 7400/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 1 Nov 2018 12:55:23 +0000 (06:55 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 1 Nov 2018 12:55:23 +0000 (06:55 -0600)
source/base/utilities.cc

index 659f82b45c995076c1f93a7b12d03ae6f74ded68..eed85074c3b62fa0c2752068600acfc8fa0c18c6 100644 (file)
@@ -132,7 +132,7 @@ namespace Utilities
     // based on that get the maximum integer:
     const Integer max_int = (min_bits == std::numeric_limits<Integer>::digits ?
                                std::numeric_limits<Integer>::max() :
-                               ((Integer)1 << min_bits) - 1);
+                               (Integer(1) << min_bits) - 1);
 
     std::vector<std::array<Integer, dim>> int_points(points.size());
 
@@ -193,7 +193,7 @@ namespace Utilities
            ExcMessage("This integer type can not hold " +
                       std::to_string(bits_per_dim) + " bits."));
 
-    const Integer M = 1 << (bits_per_dim - 1); // largest bit
+    const Integer M = Integer(1) << (bits_per_dim - 1); // largest bit
 
     for (unsigned int index = 0; index < int_points.size(); ++index)
       {

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.