Define a macro to properly construct std::bitset

git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1216679 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
This commit is contained in:
Lukáš Lalinský 2011-01-24 07:32:31 +00:00
parent df86f45dad
commit 299e3f0ad6
4 changed files with 9 additions and 3 deletions

View File

@ -189,7 +189,7 @@ void Footer::parse(const ByteVector &data)
// Read the flags
std::bitset<32> flags(static_cast<unsigned long>(data.mid(20, 4).toUInt(false)));
std::bitset<32> flags(TAGLIB_CONSTRUCT_BITSET(data.mid(20, 4).toUInt(false)));
d->headerPresent = flags[31];
d->footerPresent = !flags[30];

View File

@ -113,7 +113,7 @@ void MPC::Properties::read()
if(d->version >= 7) {
frames = d->data.mid(4, 4).toUInt(false);
std::bitset<32> flags(static_cast<unsigned long>(d->data.mid(8, 4).toUInt(false)));
std::bitset<32> flags(TAGLIB_CONSTRUCT_BITSET(d->data.mid(8, 4).toUInt(false)));
d->sampleRate = sftable[flags[17] * 2 + flags[16]];
d->channels = 2;
}

View File

@ -168,7 +168,7 @@ void MPEG::Header::parse(const ByteVector &data)
return;
}
std::bitset<32> flags(static_cast<unsigned long>(data.toUInt()));
std::bitset<32> flags(TAGLIB_CONSTRUCT_BITSET(data.toUInt()));
// Check for the second byte's part of the MPEG synch

View File

@ -36,6 +36,12 @@
#define TAGLIB_IGNORE_MISSING_DESTRUCTOR
#endif
#if (defined(_MSC_VER) && _MSC_VER >= 1600)
#define TAGLIB_CONSTRUCT_BITSET(x) static_cast<unsigned long long>(x)
#else
#define TAGLIB_CONSTRUCT_BITSET(x) static_cast<unsigned long>(x)
#endif
#include <string>
//! A namespace for all TagLib related classes and functions