Index: src/utils.h |
diff --git a/src/utils.h b/src/utils.h |
index eeb098752198d4f1ef6333bf64464e90113f61d7..d5b7274e95eed58e4b17c39006e6dc0ccb99eade 100644 |
--- a/src/utils.h |
+++ b/src/utils.h |
@@ -233,6 +233,25 @@ inline int32_t WhichPowerOf2Abs(int32_t x) { |
} |
+// Obtains the unsigned type corresponding to T |
+// available in C++11 as std::make_unsigned |
+template<typename T> |
+struct make_unsigned { |
+ typedef T type; |
+}; |
+ |
+ |
+// Template specializations necessary to have make_unsigned work |
+template<> struct make_unsigned<int32_t> { |
+ typedef uint32_t type; |
+}; |
+ |
+ |
+template<> struct make_unsigned<int64_t> { |
+ typedef uint64_t type; |
+}; |
+ |
+ |
// ---------------------------------------------------------------------------- |
// BitField is a help template for encoding and decode bitfield with |
// unsigned content. |