Skip to content

Commit

Permalink
added 20 bit integral limits (#935)
Browse files Browse the repository at this point in the history
  • Loading branch information
ReneCanadian authored Jul 30, 2024
1 parent 744d54c commit bf56dcf
Showing 1 changed file with 62 additions and 0 deletions.
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

0 comments on commit bf56dcf

Please sign in to comment.