From 1fbfaee8cb0d9b84620e7f5bd70a2b2aa90fa1da Mon Sep 17 00:00:00 2001 From: Joshua Scott Date: Fri, 26 Oct 2018 15:03:18 +0100 Subject: [PATCH] pclass: Define bit integers as primitive types on TypeSystem --- include/ki/util/BitTypes.h | 2 +- src/pclass/TypeSystem.cpp | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/include/ki/util/BitTypes.h b/include/ki/util/BitTypes.h index cec212c..048a86d 100644 --- a/include/ki/util/BitTypes.h +++ b/include/ki/util/BitTypes.h @@ -75,7 +75,7 @@ namespace ki m_value = 0; } - BitInteger(BitInteger &cp) + BitInteger(const BitInteger &cp) { m_value = cp.m_value; } diff --git a/src/pclass/TypeSystem.cpp b/src/pclass/TypeSystem.cpp index 1e1aaaa..066e74b 100644 --- a/src/pclass/TypeSystem.cpp +++ b/src/pclass/TypeSystem.cpp @@ -7,6 +7,16 @@ define_primitive("signed " n); \ define_primitive("unsigned " n) +#define DEFINE_BI_PRIMITIVE(n) \ + define_primitive< bi >("bi" #n) + +#define DEFINE_BUI_PRIMITIVE(n) \ + define_primitive< bui >("bui" #n) + +#define DEFINE_BIT_INTEGER_PRIMITIVE(n) \ + DEFINE_BI_PRIMITIVE(n); \ + DEFINE_BUI_PRIMITIVE(n) + namespace ki { namespace pclass @@ -44,6 +54,17 @@ namespace pclass define_primitive("uint64_t"); define_primitive("gid"); + // Define bit-integer types + DEFINE_BIT_INTEGER_PRIMITIVE(1); + DEFINE_BIT_INTEGER_PRIMITIVE(2); + DEFINE_BIT_INTEGER_PRIMITIVE(3); + DEFINE_BIT_INTEGER_PRIMITIVE(4); + DEFINE_BIT_INTEGER_PRIMITIVE(5); + DEFINE_BIT_INTEGER_PRIMITIVE(6); + DEFINE_BIT_INTEGER_PRIMITIVE(7); + define_primitive>("s24"); + define_primitive>("u24"); + // TODO: Define bit integer types // TODO: Define floating point types // TODO: Define bit floating point types