automagically figure out CsInt minimum and add some extra assertions
parent
58b8f3ba54
commit
ed65356dbe
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <ostd/platform.hh>
|
||||
#include <ostd/types.hh>
|
||||
#include <ostd/type_traits.hh>
|
||||
#include <ostd/string.hh>
|
||||
#include <ostd/vector.hh>
|
||||
#include <ostd/map.hh>
|
||||
|
@ -20,6 +21,10 @@
|
|||
|
||||
namespace cscript {
|
||||
|
||||
static_assert(ostd::IsIntegral<CsInt>, "CsInt must be integral");
|
||||
static_assert(ostd::IsSigned<CsInt>, "CsInt must be signed");
|
||||
static_assert(ostd::IsFloatingPoint<CsFloat>, "CsFloat must be floating point");
|
||||
|
||||
enum {
|
||||
CsIdfPersist = 1 << 0,
|
||||
CsIdfOverride = 1 << 1,
|
||||
|
|
|
@ -14,8 +14,6 @@ namespace cscript {
|
|||
using CsFloat = float;
|
||||
using CsString = ostd::String;
|
||||
|
||||
constexpr CsInt const CsIntMin = INT_MIN;
|
||||
|
||||
constexpr auto const IntFormat = "%d";
|
||||
constexpr auto const FloatFormat = "%.7g";
|
||||
constexpr auto const RoundFloatFormat = "%.1f";
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
|
||||
namespace cscript {
|
||||
|
||||
/* TODO: use actual numeric limits as soon as ostd has them */
|
||||
constexpr CsInt const CsIntMin = -(~(1ULL << (sizeof(CsInt) * CHAR_BIT - 1))) - 1;
|
||||
|
||||
template<typename K, typename V>
|
||||
using CsMap = ostd::Map<K, V>;
|
||||
|
||||
|
|
Loading…
Reference in New Issue