Skip to content
Snippets Groups Projects
Commit baf23f7a authored by ARMAR-7 User's avatar ARMAR-7 User
Browse files

static assertions for modular converted value

parent a2fca24c
No related branches found
No related tags found
1 merge request!35Split DataInterface into separate files
......@@ -26,6 +26,8 @@
#include <cmath>
#include <limits>
#include <type_traits>
#include <ArmarXCore/core/exceptions/local/ExpressionException.h>
......@@ -34,7 +36,7 @@
namespace armarx::control::ethercat
{
template <typename T, typename SignedT = T>
template <typename T, typename SignedT = std::int64_t>
class ModularConvertedValue
{
......@@ -47,6 +49,18 @@ namespace armarx::control::ethercat
maxValue = 0;
factor = 0;
isInverted = false;
static_assert(std::is_signed_v<SignedT>);
if constexpr(std::is_unsigned_v<T>)
{
static_assert(sizeof(SignedT) > sizeof(T));
}
if constexpr(std::is_signed_v<T>)
{
static_assert(sizeof(SignedT) >= sizeof(T));
}
}
void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment