Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added 20 bit integral limits #935

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions include/etl/integral_limits.h
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,54 @@ namespace etl
template <typename T>
ETL_CONSTANT bool statics_char32_t<T>::is_signed;
#endif

#ifdef ETL_20_BIT
template <typename T = void>
struct statics___int20
{
typedef __int20 value_type;

static ETL_CONSTANT __int20 min = 0x80000;
static ETL_CONSTANT __int20 max = 0x7FFFF;
static ETL_CONSTANT int bits = 20;
static ETL_CONSTANT bool is_signed = true;
};

template <typename T>
ETL_CONSTANT __int20 statics___int20<T>::min;

template <typename T>
ETL_CONSTANT __int20 statics___int20<T>::max;

template <typename T>
ETL_CONSTANT int statics___int20<T>::bits;

template <typename T>
ETL_CONSTANT bool statics___int20<T>::is_signed;

template <typename T = void>
struct statics_unsigned___int20
{
typedef unsigned __int20 value_type;

static ETL_CONSTANT unsigned __int20 min = 0;
static ETL_CONSTANT unsigned __int20 max = 0xFFFFF;
static ETL_CONSTANT int bits = 20;
static ETL_CONSTANT bool is_signed = false;
};

template <typename T>
ETL_CONSTANT unsigned __int20 statics_unsigned___int20<T>::min;

template <typename T>
ETL_CONSTANT unsigned __int20 statics_unsigned___int20<T>::max;

template <typename T>
ETL_CONSTANT int statics_unsigned___int20<T>::bits;

template <typename T>
ETL_CONSTANT bool statics_unsigned___int20<T>::is_signed;
#endif
}

//***************************************************************************
Expand Down Expand Up @@ -556,6 +604,20 @@ namespace etl
struct integral_limits<unsigned long long> : public private_integral_limits::statics_unsigned_long_long<>
{
};
#ifdef ETL_20_BIT
//***************************************************************************
///\ingroup integral_limits
//***************************************************************************
template <>
struct integral_limits<__int20> : public private_integral_limits::statics___int20<>
{
};

template <>
struct integral_limits<unsigned __int20> : public private_integral_limits::statics_unsigned___int20<>
{
};
#endif
}

#include "private/minmax_pop.h"
Expand Down
Loading