]> granicus.if.org Git - taglib/commitdiff
Fixed compilation error with GCC4.2
authorTsuda Kageyu <tsuda.kageyu@gmail.com>
Sat, 1 Jun 2013 14:55:52 +0000 (23:55 +0900)
committerTsuda Kageyu <tsuda.kageyu@gmail.com>
Sat, 1 Jun 2013 14:55:52 +0000 (23:55 +0900)
taglib/toolkit/tbytevector.cpp

index 11cc67d538f2f5b513cbd201df4fe19dc80faf8f..ce47fbb856eb88d5c88b0be87b6765b11dd58248 100644 (file)
@@ -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)
 {