+// Convenience class for min and max values of a given BITS length.
+
+template<int bits>
+class Limits
+{
+ public:
+ static const uint64_t MAX_UNSIGNED = (1ULL << bits) - 1;
+ static const int64_t MAX_SIGNED = MAX_UNSIGNED >> 1;
+ static const int64_t MIN_SIGNED = -MAX_SIGNED - 1;
+};
+
+template<>
+class Limits<64>
+{
+ public:
+ static const uint64_t MAX_UNSIGNED = ~0ULL;
+ static const int64_t MAX_SIGNED = MAX_UNSIGNED >> 1;
+ static const int64_t MIN_SIGNED = -MAX_SIGNED - 1;
+};
+