mirror of
				https://github.com/taglib/taglib.git
				synced 2025-11-04 08:45:10 -05:00 
			
		
		
		
	Fixed compilation error with GCC4.2
This commit is contained in:
		@ -296,6 +296,25 @@ ulonglong byteSwap<ulonglong>(ulonglong x)
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <class T>
 | 
			
		||||
T toNumber(const ByteVector &v, size_t offset, size_t length, bool mostSignificantByteFirst)
 | 
			
		||||
{
 | 
			
		||||
  if(offset >= v.size()) {
 | 
			
		||||
    debug("toNumber<T>() -- No data to convert. Returning 0.");
 | 
			
		||||
    return 0;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  length = std::min(length, v.size() - offset);
 | 
			
		||||
 | 
			
		||||
  T sum = 0;
 | 
			
		||||
  for(size_t i = 0; i < length; i++) {
 | 
			
		||||
    const size_t shift = (mostSignificantByteFirst ? length - 1 - i : i) * 8;
 | 
			
		||||
    sum |= static_cast<T>(static_cast<uchar>(v[offset + i])) << shift;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return sum;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <class T>
 | 
			
		||||
T toNumber(const ByteVector &v, size_t offset, bool mostSignificantByteFirst)
 | 
			
		||||
{
 | 
			
		||||
@ -317,25 +336,6 @@ T toNumber(const ByteVector &v, size_t offset, bool mostSignificantByteFirst)
 | 
			
		||||
    return tmp;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <class T>
 | 
			
		||||
T toNumber(const ByteVector &v, size_t offset, size_t length, bool mostSignificantByteFirst)
 | 
			
		||||
{
 | 
			
		||||
  if(offset >= v.size()) {
 | 
			
		||||
    debug("toNumber<T>() -- No data to convert. Returning 0.");
 | 
			
		||||
    return 0;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  length = std::min(length, v.size() - offset);
 | 
			
		||||
 | 
			
		||||
  T sum = 0;
 | 
			
		||||
  for(size_t i = 0; i < length; i++) {
 | 
			
		||||
    const size_t shift = (mostSignificantByteFirst ? length - 1 - i : i) * 8;
 | 
			
		||||
    sum |= static_cast<T>(static_cast<uchar>(v[offset + i])) << shift;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return sum;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <class T>
 | 
			
		||||
ByteVector fromNumber(T value, bool mostSignificantByteFirst)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user