From a1ac23530ee4e7077135f2ec3a6ff32bd603fefa Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu Date: Thu, 3 Dec 2015 12:34:54 +0900 Subject: [PATCH] Simpler conversion from bits to bytes. --- taglib/mpeg/id3v2/frames/relativevolumeframe.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/taglib/mpeg/id3v2/frames/relativevolumeframe.cpp b/taglib/mpeg/id3v2/frames/relativevolumeframe.cpp index 44033cbc..a907f6b9 100644 --- a/taglib/mpeg/id3v2/frames/relativevolumeframe.cpp +++ b/taglib/mpeg/id3v2/frames/relativevolumeframe.cpp @@ -31,11 +31,6 @@ using namespace TagLib; using namespace ID3v2; -static inline int bitsToBytes(int i) -{ - return i % 8 == 0 ? i / 8 : (i - i % 8) / 8 + 1; -} - struct ChannelData { ChannelData() : channelType(RelativeVolumeFrame::Other), volumeAdjustment(0) {} @@ -185,7 +180,6 @@ void RelativeVolumeFrame::parseFields(const ByteVector &data) while(pos <= (int)data.size() - 4) { - ChannelType type = ChannelType(data[pos]); pos += 1; @@ -197,7 +191,7 @@ void RelativeVolumeFrame::parseFields(const ByteVector &data) channel.peakVolume.bitsRepresentingPeak = data[pos]; pos += 1; - int bytes = bitsToBytes(channel.peakVolume.bitsRepresentingPeak); + const int bytes = (channel.peakVolume.bitsRepresentingPeak + 7) / 8; channel.peakVolume.peakVolume = data.mid(pos, bytes); pos += bytes; }