BUG: labelBits: allow negative labels

This commit is contained in:
mattijs
2013-07-18 13:07:50 +01:00
parent c608331860
commit ca3bde9f20

View File

@ -35,7 +35,7 @@ SourceFiles
#define labelBits_H #define labelBits_H
#include "label.H" #include "label.H"
#include "uLabel.H" //#include "uLabel.H"
#include "direction.H" #include "direction.H"
#include "error.H" #include "error.H"
@ -55,15 +55,17 @@ class labelBits
label data_; label data_;
inline static label pack(const uLabel val, const direction bits) inline static label pack(const label 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 uLabel, const direction)" "labelBits::pack(const label, const direction)"
) << "Direction " << bits << " outside range 0..7" ) << "Direction " << bits << " outside range 0..7"
<< " or value " << val << " negative or larger than "
<< label(8*sizeof(label)-3) << " bit representation"
<< abort(FatalError); << abort(FatalError);
} }
# endif # endif