-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
enhancementSomething can be improvedSomething can be improvedfixedSomething works now, yay!Something works now, yay!
Description
Lines 1094 to 1124 in 5be7d49
| // MACROS FOR mask_array | |
| #define _MOP(RHS) /* apply RHS(_Idx) to mask_array */ \ | |
| size_t _Off = 0; \ | |
| size_t _Size = _Totlen(); \ | |
| for (size_t _Idx = 0; _Idx < _Size; ++_Off) { \ | |
| if (_Mask(_Off)) { \ | |
| _Myptr[_Off] RHS, ++_Idx; \ | |
| } \ | |
| } | |
| // CLASS TEMPLATE mask_array | |
| template <class _Ty> | |
| class mask_array { // define a subset of a valarray with an array of mask bits | |
| public: | |
| using value_type = _Ty; | |
| void operator=(const valarray<_Ty>& _Right) const { | |
| _MOP(= _Right[_Idx]); | |
| } | |
| void operator=(const _Ty& _Right) const { | |
| _MOP(= _Right); | |
| } | |
| void operator*=(const valarray<_Ty>& _Right) const { // multiply masked array by valarray | |
| _MOP(*= _Right[_Idx]); | |
| } | |
| void operator/=(const valarray<_Ty>& _Right) const { // divide masked array by valarray | |
| _MOP(/= _Right[_Idx]); | |
| } |
Consider converting to a function that takes lambda or manually re-using the code.
Motivation: easier debugging (step by step or crash dump).
Occurrences:
Lines 60 to 72 in 5be7d49
| // MACROS FOR valarray | |
| #define _VALOP(TYPE, LENGTH, RHS) /* assign RHS(_Idx) to new valarray */ \ | |
| valarray<TYPE> _Ans(LENGTH); \ | |
| for (size_t _Idx = 0; _Idx < _Ans.size(); ++_Idx) { \ | |
| _Ans[_Idx] = RHS; \ | |
| } \ | |
| return _Ans | |
| #define _VALGOP(RHS) /* apply RHS(_Idx) to valarray */ \ | |
| for (size_t _Idx = 0; _Idx < size(); ++_Idx) { \ | |
| _Myptr[_Idx] RHS; \ | |
| } \ | |
| return *this |
Lines 874 to 879 in 5be7d49
| // MACROS FOR slice_array | |
| #define _SLOP(RHS) /* apply RHS(_Idx) to slice_array */ \ | |
| size_t _Off = _Start; \ | |
| for (size_t _Idx = 0; _Idx < _Len; ++_Idx, _Off += _Stride) { \ | |
| _Myptr[_Off] RHS; \ | |
| } |
Lines 1014 to 1020 in 5be7d49
| // MACROS FOR gslice_array | |
| #define _GSLOP(RHS) /* apply RHS(_Idx) to gslice_array */ \ | |
| _Sizarray _Indexarray(size_t{0}, _Nslice()); \ | |
| size_t _Size = _Totlen(); \ | |
| for (size_t _Idx = 0; _Idx < _Size; ++_Idx) { \ | |
| _Myptr[_Off(_Indexarray)] RHS; \ | |
| } |
Lines 1094 to 1102 in 5be7d49
| // MACROS FOR mask_array | |
| #define _MOP(RHS) /* apply RHS(_Idx) to mask_array */ \ | |
| size_t _Off = 0; \ | |
| size_t _Size = _Totlen(); \ | |
| for (size_t _Idx = 0; _Idx < _Size; ++_Off) { \ | |
| if (_Mask(_Off)) { \ | |
| _Myptr[_Off] RHS, ++_Idx; \ | |
| } \ | |
| } |
Lines 1192 to 1197 in 5be7d49
| // MACROS FOR indirect_array | |
| #define _IOP(RHS) /* apply RHS(_Idx) to indirect_array */ \ | |
| size_t _Size = _Totlen(); \ | |
| for (size_t _Idx = 0; _Idx < _Size; ++_Idx) { \ | |
| _Myptr[_Indir(_Idx)] RHS; \ | |
| } |
Metadata
Metadata
Assignees
Labels
enhancementSomething can be improvedSomething can be improvedfixedSomething works now, yay!Something works now, yay!