Commit ae7f75d8 authored by Matthias Möller's avatar Matthias Möller

- remove paranthese warning

- remove redundant double negation, as the type is already bool
- replaced inline condition with cast

closes #2491

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@1270 fdac6126-5c0c-442c-9429-916003d36597
parent e1a72035
......@@ -26,15 +26,14 @@ template <> struct binary< std::vector<bool> >
for (idx=0; idx < N; ++idx)
{
bits = 0;
bits = bits | (_v[idx+0] ? 1 : 0);
bits = bits | ((_v[idx+1] ? 1 : 0) << 1);
bits = bits | ((_v[idx+2] ? 1 : 0) << 2);
bits = bits | ((_v[idx+3] ? 1 : 0) << 3);
bits = bits | ((_v[idx+4] ? 1 : 0) << 4);
bits = bits | ((_v[idx+5] ? 1 : 0) << 5);
bits = bits | ((_v[idx+6] ? 1 : 0) << 6);
bits = bits | ((_v[idx+7] ? 1 : 0) << 7);
bits = static_cast<unsigned char>(_v[idx])
| (static_cast<unsigned char>(_v[idx+1]) << 1)
| (static_cast<unsigned char>(_v[idx+2]) << 2)
| (static_cast<unsigned char>(_v[idx+3]) << 3)
| (static_cast<unsigned char>(_v[idx+4]) << 4)
| (static_cast<unsigned char>(_v[idx+5]) << 5)
| (static_cast<unsigned char>(_v[idx+6]) << 6)
| (static_cast<unsigned char>(_v[idx+7]) << 7);
_ostr << bits;
}
bytes = N;
......@@ -44,13 +43,13 @@ template <> struct binary< std::vector<bool> >
bits = 0;
switch(R)
{
case 7: bits = bits | ((_v[idx+6] ? 1 : 0) << 6);
case 6: bits = bits | ((_v[idx+5] ? 1 : 0) << 5);
case 5: bits = bits | ((_v[idx+4] ? 1 : 0) << 4);
case 4: bits = bits | ((_v[idx+3] ? 1 : 0) << 3);
case 3: bits = bits | ((_v[idx+2] ? 1 : 0) << 2);
case 2: bits = bits | ((_v[idx+1] ? 1 : 0) << 1);
case 1: bits = bits | (_v[idx+0] ? 1 : 0);
case 7: bits |= (static_cast<unsigned char>(_v[idx+6]) << 6);
case 6: bits |= (static_cast<unsigned char>(_v[idx+5]) << 5);
case 5: bits |= (static_cast<unsigned char>(_v[idx+4]) << 4);
case 4: bits |= (static_cast<unsigned char>(_v[idx+3]) << 3);
case 3: bits |= (static_cast<unsigned char>(_v[idx+2]) << 2);
case 2: bits |= (static_cast<unsigned char>(_v[idx+1]) << 1);
case 1: bits |= static_cast<unsigned char>(_v[idx+0]);
}
_ostr << bits;
++bytes;
......
......@@ -278,14 +278,14 @@ public:
for (bidx=idx=0; idx < N; ++idx, bidx+=8)
{
bits = !!data_[bidx]
| (!!data_[bidx+1] << 1)
| (!!data_[bidx+2] << 2)
| (!!data_[bidx+3] << 3)
| (!!data_[bidx+4] << 4)
| (!!data_[bidx+5] << 5)
| (!!data_[bidx+6] << 6)
| (!!data_[bidx+7] << 7);
bits = static_cast<unsigned char>(data_[bidx])
| (static_cast<unsigned char>(data_[bidx+1]) << 1)
| (static_cast<unsigned char>(data_[bidx+2]) << 2)
| (static_cast<unsigned char>(data_[bidx+3]) << 3)
| (static_cast<unsigned char>(data_[bidx+4]) << 4)
| (static_cast<unsigned char>(data_[bidx+5]) << 5)
| (static_cast<unsigned char>(data_[bidx+6]) << 6)
| (static_cast<unsigned char>(data_[bidx+7]) << 7);
_ostr << bits;
}
bytes = N;
......@@ -320,14 +320,14 @@ public:
for (bidx=idx=0; idx < N; ++idx, bidx+=8)
{
_istr >> bits;
data_[bidx+0] = !!(bits & 0x01);
data_[bidx+1] = !!(bits & 0x02);
data_[bidx+2] = !!(bits & 0x04);
data_[bidx+3] = !!(bits & 0x08);
data_[bidx+4] = !!(bits & 0x10);
data_[bidx+5] = !!(bits & 0x20);
data_[bidx+6] = !!(bits & 0x40);
data_[bidx+7] = !!(bits & 0x80);
data_[bidx+0] = (bits & 0x01) != 0;
data_[bidx+1] = (bits & 0x02) != 0;
data_[bidx+2] = (bits & 0x04) != 0;
data_[bidx+3] = (bits & 0x08) != 0;
data_[bidx+4] = (bits & 0x10) != 0;
data_[bidx+5] = (bits & 0x20) != 0;
data_[bidx+6] = (bits & 0x40) != 0;
data_[bidx+7] = (bits & 0x80) != 0;
}
bytes = N;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment