]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Avoid integer overflow in Utilities::pack_integers 7447/head
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sat, 17 Nov 2018 11:31:49 +0000 (12:31 +0100)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sat, 17 Nov 2018 11:31:49 +0000 (12:31 +0100)
source/base/utilities.cc

index 21c1ea0b60c784e46c3338690f20315226ade008..a16d51a2da04463606e8ad9692d3a5d75f4154ba 100644 (file)
@@ -278,7 +278,7 @@ namespace Utilities
     AssertIndexRange(bits_per_dim * dim, 65);
     Assert(bits_per_dim > 0, ExcMessage("bits_per_dim should be positive"));
 
-    const Integer mask = (1 << bits_per_dim) - 1;
+    const Integer mask = (Integer(1) << bits_per_dim) - 1;
 
     Integer res = 0;
     for (unsigned int i = 0; i < dim; ++i)

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.