COMP: labelBits: unsigned integer overflow

This commit is contained in:
mattijs
2013-07-05 13:46:22 +01:00
parent 3195c2186f
commit a1ec3f06b3

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -55,14 +55,14 @@ class labelBits
label data_; label data_;
inline static label pack(const label val, const direction bits) inline static label pack(const uLabel val, const direction bits)
{ {
# ifdef FULLDEBUG # ifdef FULLDEBUG
if (bits > 7 || (((val<<3)>>3) != val)) if (bits > 7 || (((val<<3)>>3) != val))
{ {
FatalErrorIn FatalErrorIn
( (
"labelBits::pack(const label, const direction)" "labelBits::pack(const uLabel, const direction)"
) << "Direction " << bits << " outside range 0..7" ) << "Direction " << bits << " outside range 0..7"
<< abort(FatalError); << abort(FatalError);
} }