class VecRegT
{
/** Size of the register in bytes. */
- static constexpr size_t SIZE = sizeof(VecElem) * NumElems;
+ static constexpr inline size_t
+ size()
+ {
+ return sizeof(VecElem) * NumElems;
+ }
public:
/** Container type alias. */
using Container = typename std::conditional<Const,
- const VecRegContainer<SIZE>,
- VecRegContainer<SIZE>>::type;
+ const VecRegContainer<size()>,
+ VecRegContainer<size()>>::type;
private:
/** My type alias. */
using MyClass = VecRegT<VecElem, NumElems, Const>;
{
/* 0-sized is not allowed */
os << "[" << std::hex << (uint32_t)vr[0];
- for (uint32_t e = 1; e < vr.SIZE; e++)
+ for (uint32_t e = 1; e < vr.size(); e++)
os << " " << std::hex << (uint32_t)vr[e];
os << ']';
return os;
* portion through the method 'as
* @tparam Sz Size of the container in bytes.
*/
-template <size_t Sz>
+template <size_t SIZE>
class VecRegContainer
{
- static_assert(Sz > 0,
+ static_assert(SIZE > 0,
"Cannot create Vector Register Container of zero size");
- static_assert(Sz <= MaxVecRegLenInBytes,
+ static_assert(SIZE <= MaxVecRegLenInBytes,
"Vector Register size limit exceeded");
public:
- static constexpr size_t SIZE = Sz;
- using Container = std::array<uint8_t,Sz>;
+ static constexpr inline size_t size() { return SIZE; };
+ using Container = std::array<uint8_t, SIZE>;
private:
Container container;
using MyClass = VecRegContainer<SIZE>;
* @tparam NumElem Amount of elements in the view.
*/
/** @{ */
- template <typename VecElem, size_t NumElems = SIZE/sizeof(VecElem)>
+ template <typename VecElem, size_t NumElems=(SIZE / sizeof(VecElem))>
VecRegT<VecElem, NumElems, true> as() const
{
static_assert(SIZE % sizeof(VecElem) == 0,
return VecRegT<VecElem, NumElems, true>(*this);
}
- template <typename VecElem, size_t NumElems = SIZE/sizeof(VecElem)>
+ template <typename VecElem, size_t NumElems=(SIZE / sizeof(VecElem))>
VecRegT<VecElem, NumElems, false> as()
{
static_assert(SIZE % sizeof(VecElem) == 0,
inline bool
to_number(const std::string& value, VecRegContainer<Sz>& v)
{
- fatal_if(value.size() > 2 * VecRegContainer<Sz>::SIZE,
+ fatal_if(value.size() > 2 * VecRegContainer<Sz>::size(),
"Vector register value overflow at unserialize");
- for (int i = 0; i < VecRegContainer<Sz>::SIZE; i++) {
+ for (int i = 0; i < VecRegContainer<Sz>::size(); i++) {
uint8_t b = 0;
if (2 * i < value.size())
b = stoul(value.substr(i * 2, 2), nullptr, 16);